This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Help with this code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help with this code" Watch "Help with this code" New topic
Author

Help with this code

Jason Newman
Ranch Hand

Joined: Oct 20, 2010
Posts: 53
I'm not sure what's wrong with it. It's saying

4 errors found:
File: J:\Java\Java Acces\bookClasses\craps.java [line: 11]
Error: J:\Java\Java Acces\bookClasses\craps.java:11: craps is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener
File: J:\Java\Java Acces\bookClasses\craps.java [line: 24]
Error: J:\Java\Java Acces\bookClasses\craps.java:24: cannot find symbol
symbol : class JLabe1
location: class craps
File: J:\Java\Java Acces\bookClasses\craps.java [line: 54]
Error: J:\Java\Java Acces\bookClasses\craps.java:54: cannot find symbol
symbol : variable sumLabel
location: class craps
File: J:\Java\Java Acces\bookClasses\craps.java [line: 55]
Error: J:\Java\Java Acces\bookClasses\craps.java:55: cannot find symbol
symbol : variable sumLabel
location: class craps

And it's weird, because I have ALL of the required packages. I'm fairly new at this, but I really enjoy it. Any help would be greatly appreciated.

Here is the code


Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18545
    
  40

You declare a class that is a ActionListener. This requires you to implement the actionPerformed() method. If you look closely, you will see that you didn't implement that method.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Jason Newman
Ranch Hand

Joined: Oct 20, 2010
Posts: 53
How would I do this? I'm REALLY new(ish).
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18545
    
  40

Jason Newman wrote:How would I do this? I'm REALLY new(ish).


Hint: Check your spelling.

Henry
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38057
    
  22
If you have methods you are trying to override or implement from interfaces, put the @Override annotation before the method header. Then you will get a "does not override" error if you have spelt it wrongly.
Jason Newman
Ranch Hand

Joined: Oct 20, 2010
Posts: 53
Thank you for all the help, It's great to have a helpful place for Java outside of school. If I get the method working, I'll set the status as 'resolved'. Thank you again for the help!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help with this code
 
Similar Threads
Help with Control Structures.
Need Help Understand this.
Annoying Error
delay in setVisible( true )
Can someone help me out with this code