alright. the message im getting is "garden" is not an abstract method and can't override abstract method actionPreformed(java.~~~.event.Actionevent) im just trying to get my buttons to work.any help would be greatly appriciated.
Edit: just incase this needs to be noted, im working in BlueJ.
If your class implements ActionListener, you must implement all methods of that interface. There's only one method in that interface, actionPerformed, so you have to implement it, and use "quitItem.addActionListener(this);".
Or, you can just remove the "implements ActionListener" part, and leave your code as is. But as many buttons will be using your ActionListener, so I think you should leave "implements ActionListener", and implement the actionPerformed method.
The important thing to remember is that you need to pass an ActionListener to the addActionListener method. You can choose to create an anonymous class, like you did by having new ActionListener() in addActionListener. Or you can choose to implement ActionListener and pass your class to addActionListener.
PS: Next time you post code, please UseCodeTags to make your source more readable.
which means that you are implementing the ActionListener interface. Unless your Garden class is abstract (but it's not), you must implement this interface's methods. Look at the API for ActionListener (<-- click the class name). You'll see that there is a method called "actionPerformed". You must implement it. In other words, you need to have "public void actionPerformed(ActionEvent e)" in your Garden class.
It is possibole you had a tiny spelling errror in your first atttempt. Whenever you are overriding a method (or in Java 6 implementing a method from an interface), put the @Override annotation before the method heading. Then you get a compiler error like "doesn't override a superclass method" if there is a spelling error.
Since you are new, I'll add code tags and you can see how much better the code looks.
If you send is by car it's a shipment, but if by ship it's cargo. This tiny ad told me: