title: Access Instance Variables in Another Method in Java
body: <p>I'm writing a GUI in Java. One method initializes and displays a form:</p>
  
  <pre><code>public class launchQMBPMN extends CytoscapeAction {
    private JComboBox termDB;
  
    public launchQMBPMN(QMBPMN SaddleSum) {
      super("SaddleSum");
      setPreferredMenu("Plugins");
  
  
    }
  
    public class buttonListener implements ActionListener{
      public void actionPerformed(ActionEvent e){
        JFrame hello = new JFrame();
        JLabel test = new JLabel(termDB.getSelectedItem());
        test.add(hello);
        hello.show();
      }
    }
    public void actionPerformed(ActionEvent e) {
      CytoscapeDesktop desktop = Cytoscape.getDesktop();
  
      InteractionTools tools = new InteractionTools();
  
      GridBagConstraints c = new GridBagConstraints();
      c.anchor = GridBagConstraints.LINE_START;
      c.weightx = 0.5;
  
      buttonListener buttonPressed = new buttonListener();
  
      // TERM DATABASE AND WEIGHTS
  
      JPanel qmbpTermsPanel = new JPanel(new GridBagLayout());
  
      termDB = new JComboBox(tools.discoverTermDatabases());
      c.gridx = 1;
      c.gridy = 0;
      qmbpTermsPanel.add(termDB, c);  
  
  
                  ...
  </code></pre>
  
  <p>I'd like to access 'termDB' in my buttonListner class. How do I do that?</p>