setText("");不能清除文本吗? 正常的超过100行时你不要去掉前面的东东,只要让JTextArea自动往下卷就行了,textArea.setLineWrap(true); //scrollpane will never show. JScrollPane scrollpane = new JScrollPane(textArea); scrollpane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollpane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); textArea.setAutoscrolls(true);如果你要得到其中规定字符数的文本,想办法对getText处理吧!
正常的超过100行时你不要去掉前面的东东,只要让JTextArea自动往下卷就行了,textArea.setLineWrap(true);
//scrollpane will never show.
JScrollPane scrollpane = new JScrollPane(textArea);
scrollpane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scrollpane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
textArea.setAutoscrolls(true);如果你要得到其中规定字符数的文本,想办法对getText处理吧!