title: Delete a specific button
body: <p>I have a JPanel in a JFrame that contains 5 buttons. In another JPanel there is a button called "delete button", what I want to do is to click this button and than choose what button of the other 5 to delete by ckicking in one of them. Can anyone help me?</p>
  
  <pre><code>    public class gui extends JFrame implements ActionListener
      {
        JPanel p1 = new JPanel();
        JPanel p2 = new JPanel();
        JPanel p2 = new JPanel();
  
        JButton b1 = new JButton("Delete");
        JButton b2 = new JButton("A");
        JButton b3 = new JButton("B");
        JButton b4 = new JButton("C");
  
        gui()
        {
          p1.setLayout(new GridLayout(1,2));
          p1.add(p2);
          p1.add(p3);
  
          p2.setLayout(new GridLayout(3,1));
          p2.add(b2);
          p2.add(b3);
          p2.add(b4);
          p3.add(b1);
  
          b1.addActionListener(this);
          b2.addActionListener(this);
          b3.addActionListener(this);
          b4.addActionListener(this);
  
        }
  
       public void actionPerformed(ActionEvent e)
       {
         if (e.getSource() == b1)
           // When I click this button I want to be able to delete a button of my choice (one of the other 3)
       }
     }
  </code></pre>