Java – Disable word wrapping in jtextpane
•
Java
I can't find a simple way to close the word wrapping in jtextpane I can't use jtextarea because I need different colors for different text I have these ugly lines open,
Jtextarea has a setlinewrap () method, but I can't find jtextpane Why?
Solution
OK, I found a simple solution Place jtextpane in the center of JPanel with border layout Then, put JPanel into JScrollPane
Therefore, the hierarchy is as follows:
> JScrollPane > JPanel(w / Border Layout) > JTextPane
JScrollPane contains all the following contents, and jtextpane contains all the contents above it
I don't know why, but it is
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
二维码