PDA

View Full Version : Java Help



Shelnutt2
07-22-2006, 03:45 PM
"Help, I need somebody, Help not just anybody, Help!”


OK here is my problem. When I added an action listener, I got this error message. "CreditsGUI is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener".

I don't know what to do. My goal is to get the user entered variable thats put into the textfield compute it and then spit it out in the label thats across the screen. But when I added action listener I got that error message. What am I doing wrong? I'm confused.

Thanks for your help!

eshbach
07-22-2006, 05:18 PM
"Help, I need somebody, Help not just anybody, Help!”


OK here is my problem. When I added an action listener, I got this error message. "CreditsGUI is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener".

I don't know what to do. My goal is to get the user entered variable thats put into the textfield compute it and then spit it out in the label thats across the screen. But when I added action listener I got that error message. What am I doing wrong? I'm confused.

Thanks for your help!

Ok, relax. ActionListener is an Interface. What that means is that ActionListener provides a "functionality shell", but it needs you to fill in the specific operations you want to perform.

Now, the ActionListener interface specifies an ActionPerformed method that takes an ActionEvent as a parameter, so in your class that implements ActionListener, you need to create a method called actionPerformed(EventArgs e). e (or whatever you name it) will be the action that is performed by the user, in your case. it will contain the neccessary information for you to decide what course of action to take and what to have the program do to respond. Use the action performed method to carry out whatever you need to do when the action happens.

If you're still not clear, I can help get you started with the code.

ahmad
07-27-2006, 06:21 PM
There are some examples available from Sun:

http://java.sun.com/docs/books/tutorial/uiswing/events/actionlistener.html

Are you trying to use old code by any chance? A few things have change with the latest Java (1.5).