[SOLVED] ActionListener Error

When i implement ActionListener i get an error. It says: Main is not abstract and does not override abstract method onAction(String.boolean,float) in ActionListener. Can anybody help me fix this problem?

I guess you don’t implement ActionListener. I can’t tell without code, but thems are the rules.

Add this to your class.

@Override
public void onAction(String name, boolean isPressed, float tpf) {
        
}

I will also suggest you to make inner class which implements ActionListener for clarity of the code, not in the Application class if thats the case

I included onAction but when i include @Override I get: method does not override or implement a method from a supertype

It always complains about being abstract but in another code it works

I fixed the problem. Thanks for the help.

It was because of wrong code in the onAction method

In the future, if you have a problem with your code then you should post the code… else it’s the same as:
“I’m holding a piece of string. Can someone tell me how long it is?”

2 Likes

Ok. Next time I will. Thanks.

Verzonden vanuit Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 voor Windows 10