开发者

auto end line in JTextArea

I have a jTextArea with a long string.

Let's usume:

String str = "this is a toooo long string";

Now i want to show this string in one swing jTextArea. But my textArea has limited size on the frame. So, i'm not be able to see the entire string.

For exemple, the text area only shows:

"this is开发者_运维知识库 a t"

It is possible to textarea avoid hidden characters auto introducing '\n'? Note: I don't want auto scrool.

Thanks


JTextArea textArea = new JTextArea(
    "This is an editable JTextArea. " +
    "A text area is a \"plain\" text component, " +
    "which means that although it can display text " +
    "in any font, all of the text is in the same font."
);
textArea.setFont(new Font("Serif", Font.ITALIC, 16));
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);

Taken from: http://download.oracle.com/javase/tutorial/uiswing/components/textarea.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜