Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to autofit JEditorPane in a jpanel?

843806Jul 26 2009 — edited Jul 27 2009
Hi everybody,
I have added a JEditorPane to a JPanel wrapped by a splitpane, as displayed in [this snapshot|http://img40.imageshack.us/img40/7540/jeditorpaneissue.png].
The splitpanel works fine, but for some reason the JEditorPane has a fixed size and won't fit the parent when I resize it by dragging the split bar (the red arrows in the image show the annoying gap).

I'd like to improve this GUI with 2 things:
1) autofit: when I change the size of the window or I drag the split bar, the JEditorPane should fit the new size automatically. I suppose I can do this with a listener, but I was wondering if there is better way of doing it (e.g. some settings in the panel).
2) vertical scrollbar: I obviously need a scrollbar for the JEditorPane, but I don't know where I am supposed to add it.

Thanks for any hints!
Mulone
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 24 2009
Added on Jul 26 2009
4 comments
191 views