This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Problem with Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Problem with "abstract class" Watch "Problem with "abstract class" New topic
Author

Problem with "abstract class

Antony Amicone
Ranch Hand

Joined: Mar 11, 2006
Posts: 125
Hi i'm trying to use netbeans for using the system that draw gui without writing code, i did my dialog, now i'm preparing classes but i get an error



Error desktopapplication1.TbEvent is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener TbEvent.java 16


what can i do?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14193
    
  20

Your class TbEvent implements the interface ActionListener.

When you have a (non-abstract) class that implements an interface, you are required to implement all the methods in the interface. One of the methods in interface ActionListener is called actionPerformed, and it takes a java.awt.event.ActionEvent as an argument. You didn't implement that method in your class.

Add a method to class TbEvent:



Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Antony Amicone
Ranch Hand

Joined: Mar 11, 2006
Posts: 125
Jesper Young wrote:Your class TbEvent implements the interface ActionListener.

When you have a (non-abstract) class that implements an interface, you are required to implement all the methods in the interface. One of the methods in interface ActionListener is called actionPerformed, and it takes a java.awt.event.ActionEvent as an argument. You didn't implement that method in your class.

Add a method to class TbEvent:



ty a lot
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39053
    
  23
Please read this; it's "thank you" not "ty" please.
 
GeeCON Prague 2014
 
subject: Problem with "abstract class