title: I can't get the string from ActionListener to different class in Java
body: <p>I created a JComboBox and JButton to submit information. I need the information to be sent to a different class to sort it out with a switch method. But it looks like the string created inside the ActionListener is not recognized by a different class. </p>
  
  <pre><code>public Main() {
      final JComboBox comboB = new JComboBox(b);          //add int b in here for array
      comboB.setBounds(50, 30, 123, 20);
      contentPane.add(comboB);
  
      JButton btnTest = new JButton("Test");
      btnTest.setBounds(300, 350, 89, 23);
      contentPane.add(btnTest);
  
      btnTest.addActionListener(new ActionListener() {
  
          @Override
          public void actionPerformed(ActionEvent e) {
              String s = (String)comboB.getSelectedItem();
          }
      });
   }
  </code></pre>
  
  <p>How do I make it so that String s can be recognized by other classes? I have a separate class that will change action depending on what is selected from ComboBox, but I just can't seem to get this information out. Thank you.</p>