How to wrap line at specific position?# Java - 爪哇娇娃
h*b
1 楼
I want to wrap text in an editor area at a specific position, I have a
configure dialog to ask user specify line wrap at, say, 60 characters or 90
characters. Then I want the text to be displayed like that.
I can use JTextArea/JTextPane/JEditorPane, but no luck. setColumn() method
won't do it because it actually changed the size of the component, which I
don't want. I also tried to use styleddocument and override insert() method,
but in that way I have to insert new line characters which is not
configure dialog to ask user specify line wrap at, say, 60 characters or 90
characters. Then I want the text to be displayed like that.
I can use JTextArea/JTextPane/JEditorPane, but no luck. setColumn() method
won't do it because it actually changed the size of the component, which I
don't want. I also tried to use styleddocument and override insert() method,
but in that way I have to insert new line characters which is not