I created a JList
that had JTextAreas
which word wrapped appropriately when setLineWrap(true); setWrapStyleWord(true);
was used. These aren't available for JTextPane
and my god forsaken text isn't wrapping. Any advise?
Asked
Active
Viewed 811 times
1

mKorbel
- 109,525
- 20
- 134
- 319

farm ostrich
- 5,881
- 14
- 55
- 81
-
1Text panes wrap text automatically. I'm not sure what the difference is. Post your [SSCCE](http://sscce.org) showing the working code for the text area and the changed code for the text pane so we can see what the difference is. – camickr Jul 29 '11 at 00:40
-
`JTextArea`s aren't supposed to go inside of a `JList`, so I suspect they're not behaving correctly. You should use a layout manager that can lay out the components in a vertical list - see BoxLayout http://download.oracle.com/javase/tutorial/uiswing/layout/box.html – Nate W. Jul 29 '11 at 05:54
1 Answers
2
USe this example to implement your own wrap in JTextPane http://java-sl.com/wrap.html

StanislavL
- 56,971
- 9
- 68
- 98