Link to home
Start Free TrialLog in
Avatar of help_me
help_me

asked on

Unable to remove a child panel and see the new child panel (the view does not refresh)

please could you send me a code solution which will make the following code work.

In this example i am unable to see the new child panel, the screen does not refresh even though the code seems to be executed.

Panel parent = new Panel();
parent.setLayout(new BorderLayout());
Panel child = new Panel();
parent.add("Center", child);

parent.getLayout().removeLayoutComponent(child);
child = new Panel();
parent.add("Center", child);

Avatar of heyhey_
heyhey_

try
parent.doLayout();

or
child.invalidate();
parent.validate();


or even better - use CardLayout
ASKER CERTIFIED SOLUTION
Avatar of sgoms
sgoms

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