java 如何直接写入 JTextArea?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3612488/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 02:39:19 来源:igfitidea点击:
How to write directly to a JTextArea?
提问by Joseph Weissman
I want to write some text into a JTextArea. I think the answer is to extend java.io.Writer, but I'd like an authoritative answer here; is that the right thing to do?
我想将一些文本写入JTextArea. 我认为答案是扩展java.io.Writer,但我想要一个权威的答案;这是正确的做法吗?
回答by tangens
You can just use JTextArea.setText(String)and JTextArea.append(String)to do this.
你可以只使用JTextArea.setText(String)和JTextArea.append(String)来做到这一点。

