Q:

JTextArea in JTextPane - Want new line

I want to add text to a JTextArea, and to have an auto scrollbar on vertical.
but when typing horizonally, I want an auto new line when there is no space in line..
If I use only JTextArea it's OK, but when I put it in a JScrollPane, it is not
make a new line when needed.
How can I do that?
Thanks!

A:

you have to configure the textArea to wrap:
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);

You might consider reading a basic tutorial to get you started effectively :-)

