Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / December 2005

Tip: Looking for answers? Try searching our database.

JPanel repack

Thread view: 
Rob McDonald - 26 Dec 2005 18:42 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.