I tried using repaint () and validate (), but it just doesn't work.
FYI, when using Swing it should be:
panel.revalidate(); panel.repaint();
although this code is usually used when adding / removing individual components from the panel. If you change all panels, then CardLayout is the way to go.
In addition, you should extend JApplet, not Applet.
source share