[英]JTextArea inside JScrollPane multiline
I have this code for show JTextArea
inside 我有这段代码用于显示
JTextArea
text = new JTextArea("");
text.setRows(5);
text.setColumns(50);
JScrollPane scroll_pane = new JScrollPane(text, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
Now I would that when cursor reach end of text area, it goes automatically to newline(the 50 columns). 现在我想当光标到达文本区域的末尾时,它会自动转到换行符(50列)。 How can I do that?
我怎样才能做到这一点?
尝试这个:
text.setLineWrap(true);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.