I’m trying to create a simple text adventure and some modules to go along with it. The main window of the engine has a JTextArea for displaying text, a JTextField for entering text, and a JButton to act as a send button.
Right now, the only way I know of to see if enter is pressed while the user is typing in text is to scan each key as its typed to see if it’s enter or not. Is there a better way to recognize when the user hits enter when typing in a JTextField?