tags:

views:

31

answers:

1

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

+1  A: 
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

Syntax