I have a JTextArea in Java. When I place a large amount of text in it, the text area provides horizontal scrolling.
How can I make my text area wrap instead?
I have a JTextArea in Java. When I place a large amount of text in it, the text area provides horizontal scrolling.
How can I make my text area wrap instead?
Use the
JTextArea#setLineWrap
method. This is also illustrated in the SwingJTextArea
tutorialTry This :
In a Swing GUI Designer Like Netbeans IDE,
you could just 'check' the lineWrap in jTextArea property window.
if property window is hidden:
or press
In Swing GUI
add the line
Look at the API for the methods available to JTextArea, in particular
setWrapStyleWord
andsetLineWrap
.