I'm using a JPanel to hold a variable number of components.
When the number of components changes, I do a JPanel.removeAll() and
then loop through the components doing a JPanel.add().
When I do this, the on-screen display ends up empty. If I then grab
the surrounding frame and change its size, the correct display appears.
I've tried a JPanel.repaint(), but that doesn't help. It looks like I
need to force a more thurough recalculation and redraw, but I'm not
sure how to do that.
I suspect I could do a Frame.pack(), but I'd like to keep it at the
JPanel level if possible.
Any help is appreciated,
Rob
Peter - 26 Dec 2005 21:27 GMT
Hello Rob,
Just call revalidate() before calling repaint().
This should do the job.
Regards
Rob McDonald - 26 Dec 2005 22:09 GMT
Thanks very much, that did the trick.
I knew there had to be something simple....
Rob