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().removeL ayoutCompo nent(child );
child = new Panel();
parent.add("Center", child);
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().removeL
child = new Panel();
parent.add("Center", child);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
parent.doLayout();
or
child.invalidate();
parent.validate();
or even better - use CardLayout