• Post Reply Bookmark Topic Watch Topic
  • New Topic

ActionListeners HELP  RSS feed

 
sarah lee
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i need help.

can anyone tellme why im getting this error?

GUI3.java:13: GUI3 is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener
public class GUI3 extends JFrame implements ActionListener
^
1 error

please respond asap!
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Sarah,

Welcome to JavaRanch!

GUI3 declares that it implements ActionListener. This means that it provides definitions for all the methods declared in the interface ActionListener. There's only one, actually:

public void actionPerformed(ActionEvent e);

So this error message says that, although GUI3 declares that it implements ActionListener, it actually doesn't do so, because it doesn't provide a body for this method.

If you think you did implement this method, check the name, return value, and arguments closely, and make sure they match exactly.

Alternatively, you could remove "implements ActionListener", but this might cause other problems.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!