title: Unable to add actionlistener from another class
body: <p>Seems like I completely do not understand how these things work.....I have a class that extends JPanel and implements Actionlistener and then I want to add that to a class that extends JFrame....I can't get this to work.....</p>
  
  <pre><code>public class testPanel extends JFrame implements ActionListener{
  JButton someBtn;
  
  public testPanel(JButton someBtn){
      this.someBtn = someBtn;
      add(someBtn);
      someBtn.addActionListener(this);
  
  }
  
  @Override
  public void actionPerformed(ActionEvent e){
      if(e.getSource() == someBtn)
          System.out.println("this worked");
  }
  
  }
  </code></pre>
  
  <p>2nd class file</p>
  
  <pre><code>public class JavaApplication3 extends JFrame{
  
  /**
   * @param args the command line arguments
   */
  JButton button;
  
  public JavaApplication3(){
      super("blah");
      JFrame p = new testPanel(button);
      add(p);
      pack();
      setVisible(true);
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
  
  public static void main(String[] args) {
      // TODO code application logic here
      new JavaApplication3();
  }
  }
  </code></pre>