title: Java object to be accessed outside of its scope
body: <p>I'm taking a java class and as part of the requirements for my next program I need to have a button that instantiates my object and then I perform various tasks with it. My problem is that once I create my object within the actionlistener that receives the click on the button how do I now use that object?</p>
  
  <pre><code>public class Create implements ActionListener {
  
      @Override
      public void actionPerformed(ActionEvent e) {
          AdvancedAcmeTaxi taxi = new AdvancedAcmeTaxi(Double.parseDouble(input.getText()));
          selection.setEnabled(true);
          btnCreate.setEnabled(false);
      }
  
  }
  </code></pre>
  
  <p>So in the above code I have my custom listener and I then create the object but due to the scope I only have access to it here. How do I fix this? Please note that for the purview of this class there are no controllers. Just the Model and View. This is a nested class in my GUI class. It is instantiated by
      btnCreate.addActionListener(new Create());</p>