title: Button ActionListener not called inside class extending JPanel
body: <p>I have a main frame, called FrontGUI, with a side panel added to it.  This side panel is a class called FrontGUILinker that extends JPanel, and has a button on it. When I run the program, the button doesn't do anything - the ActionListener doesn't ever seem to be called.  I have several other components with similar setups, and the buttons all work on them - the only difference I can see is that they are extensions of JFrame, and they aren't direct fields of FrontGUI but instead of the maingui mentioned in the code below.  This maingui contains fields with Controller classes for each frame, including FrontGUIController, but the FrontGUILinkerController is a field in FrontGUIController. Here are outlines of my classes, with hopefully just the unrelated things left out. The main JFrame class:</p>
  
  <pre><code>public class FrontGUI extends JFrame {
      public FrontGUILinker linkerPanel;
      public JButton btnShowhideLinker;
  
      public FrontGUI() {
        linkerPanel = new FrontGUILinker();
        contentPane.add(linkerPanel, BorderLayout.EAST);
  
        btnShowhideLinker = new JButton("Show/Hide Linker");
        contentPane.add(btnShowhideLinker);
      }
  }
  </code></pre>
  
  <p>Here's it's "controller" class.  The side panel can be shown or not shown, which is what this action listener does, and this seems to work just fine.</p>
  
  <pre><code>public class FrontGUIController {
      public MAINGUI maingui;
      private FrontGUI frame;
      public FrontGUILinkerController linkerController;
  
      public FrontGUIController(MAINGUI parent) {
         maingui = parent;
         frame = new FrontGUI();
         linkerController = new FrontGUILinkerController(maingui);
  
         //Button: Show/Hide linkerPanel
         frame.btnShowhideLinker.addActionListener( new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent arg0) {
             frame.linkerPanel.setVisible(!frame.linkerPanel.isVisible());
         }});
  
      }
  
  }
  </code></pre>
  
  <p>Here is the FrontGUILinker class:</p>
  
  <pre><code>public class FrontGUILinker extends JPanel {
     public btnCreateLink;
  
     public FrontGUILinker() {
         btnCreateLink = new JButton("Create Link");
         add(btnCreateLink);
     }
  }
  </code></pre>
  
  <p>Here is the controller for that class:</p>
  
  <pre><code>public class FrontGUILinkerController {
     public MAINGUI maingui;
     private FrontGUILinker frame;
  
     public FrontGUILinkerController(MAINGUI parent) {
        maingui = parent;
        frame = new FrontGUILinker();
  
        // Add listener to Create Link button
        frame.btnCreateLink.addActionListener( new ActionListener() {
           @Override
           public void actionPerformed(ActionEvent arg0) {
               System.out.println("Create Link button has been clicked");
           }});
     }
  }
  </code></pre>
  
  <p>Anybody have an idea why this isn't working?</p>