• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with this code

 
Jason Newman
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 21490
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jason Newman
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would I do this? I'm REALLY new(ish).
 
Henry Wong
author
Marshal
Pie
Posts: 21490
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jason Newman wrote:How would I do this? I'm REALLY new(ish).


Hint: Check your spelling.

Henry
 
Campbell Ritchie
Sheriff
Pie
Posts: 50171
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic