title: How to pass parameters to anonymous class?
body: <p>Is it possible to pass parameters, or access external parameters to an anonymous class? For example:</p>
  
  <pre><code>int myVariable = 1;
  
  myButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
          // How would one access myVariable here?
      }
  });
  </code></pre>
  
  <p>Is there any way for the listener to access myVariable or be passed myVariable without creating the listener as an actual named class?</p>