I want to avoid an output like this:
Here is some text t
hat is being wrappe
d by characters, sp
litting words in ha
lf
I am using a JTextArea, with setLineWrap(true). How can I make it wrap words, though? (Is there a way to make it only wrap when there is a space or something?)
To wrap the lines of JTextArea we need to call the setLineWrap(boolean wrap) method and pass a true boolean value as the parameter. The setWrapStyleWord(boolean word) method wrap the lines at word boundaries when we set it to true .
If focus is on a JTextField and enter is pressed, the text field fires an ActionEvent.
JTextArea.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