This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.