title: Get input from JFrame
body: <p>I am a little bit confused on exactly how to program this. I have a class extending JFrame with two textfields. I want to be able to get input from JFrame. Somehow just wait for the input from my mainMaybe class...Any ideas?</p>
  
  <pre><code>import java.awt.BorderLayout;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  
  import javax.swing.JFrame;
  import javax.swing.JTextField;
  
  
  public class mainMaybe extends JFrame{
      JTextField login;
      JTextField pass;
  
      public mainMaybe() throws InterruptedException{
          login = new JTextField();
          pass = new JTextField();
          pass.addActionListener(new ActionListener(){
              public void actionPerformed(ActionEvent arg0) {
                   System.out.println("DO SOMETHING");
              }       
          });
          add(login,BorderLayout.NORTH);
          add(pass,BorderLayout.SOUTH);
          pack();
          setVisible(true);
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      }
  
      public void returnEmail(){
          //SOME HOW WAIT FOR THE ACTION LISTENER?
      }
  
      public static void main(String[] args) throws InterruptedException {
          new mainMaybe().returnEmail(); 
          //CONTROL SHOULD STAY WITH mainMaybe until an email is returned         
      }
  
  }
  </code></pre>