JPanel preferredsize help.
807607Oct 24 2006 — edited Oct 24 2006Folks,
Here is what I did:
I put one JPanel in a JScrollPane, and put this JScrollPane in a JFrame. I set a preferredsize of this JPanel so the scroll bar could be seen.
When the program is running, sometimes it figures out that the set preferredsize is too small so it set a new larger preferredsize and repaint(). Now this is the problem:
The new preferredsize won't show immediately. Just the old new preferredsize shows. But when I resize the JFrame, either minimize or maximize, the new preferredsize was then applied correcly.
My question is, how to apply the new preferredsize immediately? What need I do before repaint() the JPanel? What event fired by JFrame resize can apply the new set preferredsize of its component?
Thanks a lot for help!