I tried to use jTextPane1.setText("xxx xxxx xxx xxxxx xx xxx xxxx xxx etc...");
but JTextPane
does not word wrap it at all showing all the text in one line only instead.
It would be interesting to support word wrap on jTextPane1
resized too...
So my question is...
how to make JTextPane
support word wrap?
Try using a JTextArea
and call setWrapStyleWord(true);
on its instance this should do what you need.
EDIT:
If you need to use a JTextPane
as a requirement(which you said you do), then have a look at a similar question that I found which answer should be of help: How is word-wrapping implemented in JTextPane, and how do I make it wrap a string without spaces?