JEditorPane
is the right component to display HTML. A HTML file is streamed into the editor pane and therefore the pane doesn't know its true preferred size until the HTML file was entirely read.
JTextPane
displays a StyledDocument
which, for similar reasons, doesn't have a (trustworthy) preferred size.
JEditorPane
and JTextPane
to a JScrollPane
and set the scroll pane's preferredSize
property.
Don't be fooled by the fact, that a JEditorPane or JTextPane you insert into a design grid, is (most often) displayed like it should - RADi calculates the layout's preferred size multiple times.
|