java JavaFX如何将文本写入textArea中的新行?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28397700/
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-11-02 13:32:31 来源:igfitidea点击:
JavaFX how to write text to a new line in a textArea?
提问by Attila Toth
I use this:
TextA.appendText(String)
Is there a way to put the text to the next line?
我用这个:
TextA.appendText(String)
有没有办法把文本放到下一行?
回答by eckig
String newLine = System.getProperty("line.separator");
Or if you want to have it a bit more direct:
或者,如果你想让它更直接一点:
String newLine = "\n";
Append or prepend the new line to your TextArea
to create new lines.
将新行附加或预先添加到您的TextArea
以创建新行。
回答by Casey Bowden
TextA.appendText("\n")
TextA.appendText("\n")
Will add a new line.
将添加一个新行。