title: Removing all components of JPanel
body: <p>I've done a lot of research and tried a lot of things but my aim is to do this: I have three buttons at the moment. For button 1 - the Play button, I want to click it and the result is to remove ALL buttons on the screen.</p>
  
  <p>Here is my code at the moment</p>
  
  <pre><code>public class Menu extends JFrame implements ActionListener {
  
  //Variables here
  
  public void createUI() {
      frame = new JFrame();
  
      frame.setTitle("Maze Game");
      frame.setSize(500, 500);
  
      frame.setVisible(true);
      panel.setLayout(new GridLayout(3, 1, 0, 19));
      panel.setVisible(true);
      JButton b = new JButton("Play");
      b.setSize(20, 10);
      b.setBackground(new Color(59, 89, 182));
      b.setForeground(Color.WHITE);
      b.setFocusPainted(false);
      b.setFont(new Font("Tahoma", Font.BOLD, 12));
      panel.add(b);
  
      JButton b0 = new JButton("Help");
      b0.setBackground(new Color(59, 89, 182));
      b0.setForeground(Color.WHITE);
      b0.setFocusPainted(false);
      b0.setFont(new Font("Tahoma", Font.BOLD, 12));
      b0.addActionListener(this);
      panel.add(b0);
  
      JButton b1 = new JButton("Quit");
      b1.setBackground(new Color(59, 89, 182));
      b1.setForeground(Color.WHITE);
      b1.setFocusPainted(false);
      b1.setFont(new Font("Tahoma", Font.BOLD, 12));
      b1.addActionListener(this);
      panel.add(b1);
  
      frame.getContentPane().add(panel);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
  }
  </code></pre>
  
  <p>Now my problem is this:</p>
  
  <pre><code>public void actionPerformed(ActionEvent e) {
      if (e.getActionCommand().equals("Quit")) {
          frame.dispose();
      } else if (e.getActionCommand().equals("Help")) {
          JFrame j1 = new JFrame();
          j1.setSize(200, 200);
          j1.setVisible(true);
      } else if (e.getActionCommand().equals("Play")) {
          //panel.removeAll();
          //revalidate(); 
          //repaint();
          //frame.getContentPane().remove(panel);
  
      }
  }
  </code></pre>
  
  <p>I want it so when I click the "Play" button it removes the button as well as the Help button and Quit button. </p>
  
  <p>I've tried the commented bits of code but with no success. Hopefully I've made things clear. To reiterate, I want to remove all the buttons (basically a blank window) after I click play.</p>