我将套接字输出打印到 textArea (它在 Service 对象中),但过了一会儿,我的 textArea 被填满并给了我异常,所以我尝试用 textArea.setText(""); 但 textArea.getLength() 不会重置为 0。这是我的代码:
if(textArea.getLength() > 1000)
textArea.setText(""); // problem!
command = in.getText(); //command to sent to socket
out.println(command);
textField.setText(""); // just resetting textField (works)
谢谢!