title: Adding JPanel to JMenuItem
body: <p>I have added buttons and <strong>text fields</strong> to a panel, but when I try to add the panel to the <code>MenuItem</code> nothing happens. I have defined an <code>ActionListener</code> for the <code>MenuItem</code> in which I am adding the <code>JPanel</code>. No error is detected by the compiler, but nothing happens when I click the <code>MenuItem</code>. How can I resolve this issue?</p>
  
  <pre><code>public class MenuFrame extends JFrame {
      private JMenu customers;
      private JMenu purchase;
      private JPanel panel1 = new JPanel();
  
      public MenuFrame() {
          JButton button = new JButton();
          panel1.add(button);
          customers = new JMenu("Customers");
  
          JMenuItem createInvoice = new JMenuItem("Create");
          JMenuItem updateInvoice = new JMenuItem("Update");
          JMenuItem deleteInvoice = new JMenuItem("Delete");
  
          sales.add(createInvoice);
          PanelHandler p = new PanelHandler(panel1);
          createInvoice.addActionListener(p);
      }
  
      private class PanelHandler implements ActionListener {
          private JPanel panel;
  
          public PanelHandler(JPanel p) {
              this.panel = p;
          }
  
          public void actionPerformed(ActionEvent e) {
              // getContentPane().removeAll();
              // getContentPane().setVisible(true);
              // JButton b=new JButton("Enter");
              // panel.add(b);
              panel.setVisible(true);
              add(panel, BorderLayout.SOUTH);
              getContentPane().doLayout();
              // update(getGraphics());
          }
      }
  }
  </code></pre>