title: ActionListener JTextField Java
body: <p>Suppose we have two JButton objects with captures "Calculate" and "Exit". For the sake of not creating classes implemented by ActionListener, we hve the whole class inplemented by ActionListener, and the method ActionPerformed looks like this:</p>
  
  <pre><code>public void actionPerformed(ActionEvent e) {
  
      if (e.getActionCommand().equals("Calculate"))
          // do what "calculate" button does
      else if (e.getActionCommand().equals("Exit"))
          System.exit(0);
  
  }
  </code></pre>
  
  <p>My question is what if we have two text fields (JTextField). How should we rewrite actionPerformed method? what is the method to return the JTextField name after the user hits Enter key in that field?</p>