PDA

View Full Version : removeFromParent then add a new widget does not show until resized



tanchi
10 Feb 2010, 6:04 PM
Hi, I have a button in my panel and an event triggered on the button will remove the button by calling button.removeFromParent();

Then I added another progressBar widget at the same location right after the removeFromParent() call:
subPanel.add(new ProgressBar());

The problem is that the button is removed, but the progress bar is now showing. Even I do
subPanel.repaint();

the progressbar is still now showing, but if I open other panel then come back it, it will show.

How to fix this? Thanks!

tanchi
12 Feb 2010, 9:46 AM
I found the answer. Just call container.layout() will show the new item.