How to remove all components from a JFrame in Java?
You must call private JFrame frame = new JFrame(); … … frame.getContentPane().removeAll(); frame.repaint(); removeAll() has not been overridden as add() or remove() to forward to the contentPane as necessary.