The following method has the end result I need. The problem is, when the method is called, the starting pnlMain
stays visible until the new pnlMain
is created and replaces the original.
The point of this method is to change the panel by creating a new one but this process takes a little time, so I am trying to have the "load" panel show up during that time.
public void changePanel() {
remove(pnlMain);
add(load);
repaint();
pnlMain = new HunterPanel(settings); // HunterPanel extends JPanel
remove(load);
add(pnlMain);
repaint();
pnlMain.requestFocus();
}