• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error while implementing ActionListener

 
divya sharma
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to implement an ActionListener. But when I am running it. Error appears

D:\JavaProg\head first\chap-12\SimpleGui1B.java:4: SimpleGui1B is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener
public class SimpleGui1B implements ActionListener
^
1 error

Tool completed with exit code 1

My Code is:

import javax.swing.*;
import java.awt.event.*;

public class SimpleGui1B implements ActionListener
{
JButton button;

}

My java version is j2sdk1.4.2_13

Thanks,
Divya
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A class that implements ActionListener has to have an actionPerformed method. See the Javadoc for details.
 
divya sharma
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your help!!
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic