So I'm basically done with this program I've been working on for awhile...I made the entire thing to run in Eclipse's console, and now I've been setting it up to run in a jFrame/jPanel. I made the jFrame, added some jLabels and and jTextArea and a jTextField. Basically what I need the program to do is take what the user enters into the textfield and then 1. send that line to the text area and 2. set what they entered to a string. I've never used actionlisteners so I'm assuming the way I've written it is completely wrong. At the moment I enter words into the field and hit enter and nothing happens. Here's some snippets of the code (excluding the middle parts because it would be a long paste if I included the whole thing).
Code:
static ActionListener listener = null;
	
	public static void main(String[] args){
        -------------unimportant lines------------
        AnswerBox.setText("Enter Text Here");  // answerbox is the jTextField declared earlier
        AnswerBox.addActionListener(listener); //attempting to declare the action listener? wrongly?


        --------much later on-------------
        @Override
	public void actionPerformed(ActionEvent e) {
		jTextArea1.append(AnswerBox.getText());
		textEntered = AnswerBox.getText();
		if (e.getActionCommand().equals("1")) {
			ready = AnswerBox.getText();
	}
	}
So I understand this is complicated to read but hopefully you can understand what I'm getting at. Basically I need the actionlistener to activate whenever the user hits enter, and to then do the thing determined under action performed. How can I make it work? Thanks for the help in advance.