This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma 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: 14950
    
  26

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: 43905
    
  32
Please read this; it's "thank you" not "ty" please.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with "abstract class
 
It's not a secret anymore!