title: Getting input from a JTextField and putting it into an if/else statement
body: <p>I have been working on a program that gets the text from a textfield in a JFrame. here is the code for getting the text: </p>
  
  <pre><code>JTextField textField = new JTextField(a3);
  
  String text = textField.getText();
  
      if (text.equals("hi")){
          textArea.setText("Hey!");
      }`
  </code></pre>
  
  <p>When I run the code everything works fine and the JFrame comes up. But when I change the text and then press enter, it does nothing. Do I need to use an ActionListener?</p>