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:
JTextField textField = new JTextField(a3);
String text = textField.getText();
if (text.equals("hi")){
textArea.setText("Hey!");
}`
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?