title: How can I access enclosing class instance variables from inside the anonymous class?
body: <p>How do I access <code>instance variables</code> from inside the anonymous class's method ?</p>
  
  <pre><code>class Tester extends JFrame {
  
     private JButton button;
     private JLabel label;
     //..some more
  
     public Tester() {
          function(); // CALL FUNCTION
     }
  
     public void function() {
        Runnable r = new Runnable() {
           @Override
           public void run() {
              // How do I access button and label from here ?
           }
        };
        new Thread(r).start();
     }
  }
  </code></pre>