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 / February 2005

Tip: Looking for answers? Try searching our database.

Why is panel not redrawing?

Thread view: 
SPG - 15 Feb 2005 17:41 GMT
Hi,

I have a simple Panel, that I add a set of other panels to dynamically..
I have a combo box that contains a list. Selecting an item forces a new
panel to be added below.
When I do this, the panel that is added does not display until I resize the
window manually.

I have tried all sorts of repaint(), update() etc, but no good.
I have seen this before but am racking my brains trying to remember how I
fixed it..

Code below.. Assume that _displayPanel is already sitting on the main Frame
using a borderlayout and was added using the CENTER parameter.

<snip>
private void showStudyPanel(int type){
       _displayPanel.removeAll();
       Panel p = _descriptors[type].getDisplayPanel();
       if( p!= null){
           System.out.println("ADDING PANEL!");
           _displayPanel.add(p);
       }
       _displayPanel.invalidate();
       _displayPanel.repaint();
   }
</snip>
SPG - 15 Feb 2005 17:46 GMT
OK, Fixed it myself..

Added a
   panel.paintAll(panel.getGraphics());

And it solved the prob.

> Hi,
>
[quoted text clipped - 23 lines]
>    }
> </snip>


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.