title: Calling methods of "parent" component in Java
body: <p>I have the following situation I think would be best to show in sample program code.  I have a Java class that extends <code>JPanel</code>.  In this class are two objects which are two more <code>JPanels</code>.  In one of the <code>JPanel</code> objects is a <code>JTable</code> object.  I added a listener to this <code>JTable</code> that detects a double click.  When it detects a double click, I want to fire a method in the top class.  How do I reference this method in Java?</p>
  
  <pre><code>public class TopPanel extends JPanel {
  
    JPanel OnePanel;
    JPanel TwoPanel;
  
    public void MethodToFire;
  
  }
  
  public class OnePanel extends JPanel {
  
    JTable TheTable;
  
  }
  
  public class TheTable extends JTable {
  
    public TheTable {
      this.addMouseListener(new MouseAdapter(){
        public void mouseClicked(MouseEvent e){
            if (e.getClickCount() == 2){ SYNTAX CALLING THE METHOD IN TopPanel  }
        }
      } );
    }
  }
  </code></pre>