Link to home
Start Free TrialLog in
Avatar of kfcox
kfcox

asked on

CardLayout not updating display of card until event handler exits

I have a dialog that contains a panel with a CardLayout.  This panel contains two child panels that I need to be able to switch between upon pressing a dialog button.  However, when I call CardLayout.show() in the button's "action performed" handler, nothing (visual) happens!  Only after
the event handler exits does the display get updated with the selected card.  This is a real problem, because the event handler performs a task that may take several seconds, and the card I'm trying to switch to is supposed to show a progress bar for the task.

Is there any way to get the card layout to update the display immediately from inside the event handler???  I'm using JDK 1.1.6 with Swing components on WinNT 4.0 with JBuilder2.

I've wasted a lot of time trying to find a workaround, but so far I've come up empty handed.  PLEASE HELP!!
Avatar of sailwind
sailwind

Try and invoke the panel's paintAll() method. This will repaint
the panel, along with all of its components. This will hopefully
update the window. Also try to see if repaint will work.

If the code is not too big, you might want to mail us the panel
containing the info.
ASKER CERTIFIED SOLUTION
Avatar of sailwind
sailwind

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kfcox

ASKER

That did the trick!  THANKS!!!