I have a complex JPanel, that has various nested JPanels as components.
I want to replace one of these nested panels with a new one. But I can't get Top-Level Panel to redraw with new components unless I delete and add them all again:
JPanel topLevel = new JPanel();
JPanel upperPane = new JPanel();
JPanel lowerPane = new JPanel();
JPanel infoPane = new JPanel();
upperPanel.add(infoPane);
topLevel.add(UpperPane);
topLevel.add(lowerPane);
// The above (psuedocode) display nicely. //Now I want to:
infoPane = new JPanel(); //Changed this Panel somehow;
topLevel.revalidate();
topLevel.repaint();
//The above 2 lines do NOT display the new information.
How can I get it to update?