I need to display read-only text such that it wraps and contains style.
If I use JTextArea, set columns to something and flag the appropriate properties to wrap, I get exactly what I want with the exception of the style. For example,
The quick brown fox
jumped over the lazy
dog.
If I use JEditorPane to style the text (for example, make the word "brown" bold) by setting the content type to "text/html" and setting the text to the appropriate html, I get the style (i.e., color) that I want but my text no longer wraps. For example,
The quick brown fox jumped over the lazy dog.
My text area ends up being added to a JPanel with other things (using GridBadLayout) and this JPanel is placed in a scroll pane.
Does anyone have any suggestions for how I can get both word wrapping and style?
Thanks!
If I use JTextArea, set columns to something and flag the appropriate properties to wrap, I get exactly what I want with the exception of the style. For example,
The quick brown fox
jumped over the lazy
dog.
If I use JEditorPane to style the text (for example, make the word "brown" bold) by setting the content type to "text/html" and setting the text to the appropriate html, I get the style (i.e., color) that I want but my text no longer wraps. For example,
The quick brown fox jumped over the lazy dog.
My text area ends up being added to a JPanel with other things (using GridBadLayout) and this JPanel is placed in a scroll pane.
Does anyone have any suggestions for how I can get both word wrapping and style?
Thanks!