How to autofit JEditorPane in a jpanel?
843806Jul 26 2009 — edited Jul 27 2009Hi 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