Why isn't this ActionListener
working? I've tried to follow tutorials but I keep getting the same error.
public class listenerTest implements ActionListener {
@Override //<-- This adds another error
public void actionPerformed(ActionEvent e)
{
System.out.println("Message"+e.toString());
System.exit(0);
}
}
And in the other file:
loginButton.addActionListener(new listenerTest());
NetBeans says
there are compilation errors on listenerTest class "listenerTest is not abstract and
does not override abstract method actionPerformed(ActionEvent) in ActionListener"`
and the error on @Override
says method does not override or implement a method from supertype
.
Any help how to fix this?
I had mixed up JavaFX and AWT ActionEvent imports. Thanks, @Reimeus!
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments