When a TAB Character is in an JTextArea text, the text
is written over the JScrollPane.
The following Code demonstrate the problem.
------ TESTCASE ----------------------------------
import charvax.swing.JFrame;
import charvax.swing.JScrollPane;
import charvax.swing.JTextArea;
public class Testcase04 extends JFrame {
final static String TAB ="\t";
//final static String TAB =" ";
final String TESTTXT =
"The quick brown " + TAB + "fox jumps over the lazy dog\n"+
"The quick brown " + TAB + "fox jumps over the lazy dog\n"+
"The quick brown " + TAB + "fox jumps over the lazy dog\n"+
"The quick brown " + TAB + "fox jumps over the lazy dog\n"+
"The quick brown " + TAB + "fox jumps over the lazy dog\n"+
"The quick brown " + TAB + "fox jumps over the lazy dog\n"+
"The quick brown " + TAB + "fox jumps over the lazy dog\n"+
"The quick brown " + TAB + "fox jumps over the lazy dog\n" ;
public Testcase04() {
super();
this.setTitle("Hello World Again !");
this.setSize(40, 20);
JScrollPane scrollpane = new JScrollPane();
JTextArea textarea = new JTextArea();
textarea.setRows(5);
textarea.setColumns(40);
scrollpane.setViewportView(textarea);
this.add(scrollpane);
textarea.setText(TESTTXT);
this.setVisible(true);
}
public static void main(String[] args) {
Testcase04 tc = new Testcase04();
}
}