Razer
Razer

Reputation: 47

ActionListener "not abstract and does not override" error

I keep getting the "is not abstract...." error, I've searched around and tried @Override, but it doesn't work. I don't know what I'm doing wrong, I just followed a youtube video. Thanks.

JButton delete = new JButton("delete");
delete.setPreferredSize(new Dimension(100,25));
delete.addActionListener(new ActionListener(){ //this line gets the error
public void actionperformed(ActionEvent e){
} 
});

Upvotes: 0

Views: 1162

Answers (1)

Dirk
Dirk

Reputation: 31053

If that is your exact code, then try actionPerformed instead of actionperformed (note the capital P in Performed). The compiler seems the be complaining, that you fail to provide an implementation of the method actionPerformed (declared in ActionListener, of which you create an instance by virtue of anonymous inner classes) due to this typo.

Upvotes: 3

Related Questions