Java – jtextpane – dynamic line wrap
•
Java
I tried to use jtextpane1 setText(“xxx xxxx xxx xxxxx xx xxx xxxx xxx etc ……”); But jtextpane doesn't wrap it up and only displays all the text in one line
So my question is... How to make jtextpane support line wrap?
Solution
Try to use jtextarea and call setwrapstyleword (true); In its case, this should do what you need
Edit:
If you need to use jtextpane as a requirement (you said you did), look at the similar question I found which answer should be helpful: how is word wrapping implemented in jtextpane, and how do I make it wrap a string without spaces?
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码