Duplicate :
|
JDK Version:1.2beta3-J OS: Win95 Locale: zh On win95, TextArea can not contain more than a certain number lines. In solaris, TextArea is more robustness. ==========================CheckTextArea.java============================= import java.awt.*; import java.awt.event.*; public class CheckTextArea implements ActionListener { TextArea t; Button b; public static void main(String args[]) { new CheckTextArea(); } public CheckTextArea() { Frame f = new Frame(); b = new Button("Rest Text"); b.addActionListener(this); t = new TextArea(20, 20); f.setLayout(new BorderLayout()); f.add("North", b); f.add("South", t); String s = ""; for (int i = 0; i < 3000; i++) { s = s + "My Number is " + i + "\n"; } t.setText(s); f.pack(); f.setVisible(true); } public void actionPerformed(ActionEvent e) { t.setText(""); for (int i = 0; i < 100; i ++) { t.append("My Number is " + i + "\n"); } } } =========================================================================== java CheckTextArea Please see the last line of this TextArea. Then you can press the button, you can see just one line containing the same letter. But in fact I have added many line of strings, it just cut the string except the first letter. jim.hu@prc 1998-03-05