I am implementing a Comment box facility in my application which user can resize using mouse. This comment box contains a scrollpane which instead contains a JEditorPane
in which user can insert comment. I have added the editor pane inside a scroll pane for the following reason:
When the user resizes the comment box, I am setting the desired size for JScrollPane
and the JEditorPane
. When the user is increasing the size of the comment box, the size of these components are increasing as desired but when the size of the comment box is decreased, the size of the JEditorPane
does not decrease even after setting the size. This leads to the scrollbars inside the scrollpane.
I tried using setPreferrredSize
, setSize
, setMaximumSize
for JEditorPane
. Still the size of the editor pane is not reducing. I tried calling revalidate()
or updateUI()
after the setting of size but no use.
I am using Java 1.4.2.
Please provide me some insight....