i would like to check whether the text in a text box matches a certain string. I have used an action listener, when the button is pressed it will check whether the text in the text box matches a certain word.
Thanks
This is what i have tried:
enter.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
        if (txtbox.getText() == "cat") {
            txtbox.setText("correct");
        }
    }
});
 
     
     
    