JEditorPane
is the right component to display HTML or RTF files whereas JTextPane
displays a StyledDocument
. What they have in common is, they don't have a (reliable) preferred size. As a consequence, you should add JEditorPane
and JTextPane
to a JScrollPane
and set the scroll pane's preferredSize
property.
JEditorPane
or a JTextPane
into a layout, RADi automatically creates a scroll pane for the text component and inserts the scroll pane (the only exception is when you add a JEditorPane
or a JTextPane
directly to a scroll pane). The scroll pane's preferredSize
property is set to Dimension(160,120)
.
Note: The content of a StyledDocument can not be internationalized. The page property of JEditorPane (which references the displayed document) can be internationalized (see Internationalization).
|