I have applet in witch is JTextPane, from database reads StyledDocuments.
I'm trying to get a JTextPane to adjust its height according to whatever content I feed it. All I can do is to set a fixed height in pixels using Dimension.
How do I make the JTextPane collapse/expand so it will fit to contents?
Users don't like the size of components to keep changing size. Normally you add the text pane to a JScrollPane and set the preferred size of the scroll pane to be a reasonable size. Then srollbar will appear if necessary. This is the way all applications are designed like you web browser or even this forum. Scroll bars will appear if the text of you question is too long.