i am trying to create an applet with drop-down lists. when i compile the program the following error message appears '. . .is not abstract and doesnt overide abstract method actionPerformed. . . Here is my code . . . .help please
[Edit - added code tags - MB]
John Jai
Bartender
Joined: May 31, 2011
Posts: 1776
posted
0
The class implements the ActionListener but the abstract method actionPerformed() is not implemented. Check your method signature.
bothwell muyambo
Greenhorn
Joined: Oct 21, 2011
Posts: 8
posted
0
i am very new to java and would want some more clarification on the implementation part and avoiding this error message. thank you
ActionListener is an interface. Any (non-abstract) class implementing an interface must provide an implementation of every method in the interface. ActionListener contains a method "actionPerformed", whereas you have implemented "actionPerfomed". Just a small spelling mistake, but these things matter.
Incidentally, you have other problems as well. Never use == to check for String equality, use the equals() method instead.
John Jai
Bartender
Joined: May 31, 2011
Posts: 1776
posted
0
When you implement an interface you have to either implement the methods or mark the methods abstract. In your code you have actually tried to implement the method actionPerformed(). But the name of the method is incorrect. You have missed a 'r'.
bothwell muyambo
Greenhorn
Joined: Oct 21, 2011
Posts: 8
posted
0
a big thank you to john and mathew.The problem has been fixed thank you
Tim Moores
Rancher
Joined: Sep 21, 2011
Posts: 2407
posted
1
Here's a very useful bit of advice: learn to use @Override annotations, whenever you override or implement methods. Big timesaver for exactly the kind of mistake you made here!