I want to add a JTextArea
to an application. Normally that textarea contains large content and both horizontal and vertical ScrollBars
appear when running that application. I want to remove horizontal scrolling; I have found that it is possible with
HORIZONTAL_SCROLLBAR_NEVER
field but then it does not show the complete contents (it doesn't wrapped horizontally and move content to next row). how to overcome this. I want to stop horizontal scrolling and put contents in next row without scrolling it on a row.
Just set the display to "none" using the CSS class for the horizontal bar.
You can use JTextArea#setLineWrap(true) by default is set to false. Sets the line-wrapping policy of the text area. If set to true the lines will be wrapped if they are too long to fit within the allocated width. If set to false, the lines will always be unwrapped.
Try this:
yourJTextArea.setLineWrap(true);
yourJTextArea.setWrapStyleWord(true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With