Results 1 to 4 of 4
Thread: 2D Game Code Help
- 02-08-2013, 04:15 AM #1
Member
- Join Date
- Feb 2013
- Posts
- 2
- Rep Power
- 0
2D Game Code Help
Hello,
I am trying to make a simple 2D game. However, i am running into a problem with the 'Board'.
public class Board extends JPanel implements ActionListener {
Caused by: java.lang.RuntimeException: Uncompilable source code - striker.Board is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener
at striker.Board.<clinit>(Board.java:22)
It seems that Java doesn't like the Board part.
Additional Information:
public static void main(String[] args){
JFrame frame = new JFrame("2d Game");
frame.add(new Board());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
frame.setSize(1600,900);
frame.setVisible(true);
}
Any Thoughts?
Thanks.
-
Re: 2D Game Code Help
If your class says that it implements an interface, then if it isn't abstract (and yours shouldn't be), it absolutely has to implement all of the methods of that interface. Specifically, your class states that it implements ActionListener, but it does not implement the actionPerformed method specified the ActionListener interface. As usual, the compiler error is telling your exactly what is wrong.
Last edited by Fubarable; 02-09-2013 at 01:12 AM.
- 02-08-2013, 11:07 PM #3
Member
- Join Date
- Feb 2013
- Posts
- 2
- Rep Power
- 0
Re: 2D Game Code Help
Sweet.
Thank you!
-
Similar Threads
-
Quick question about a game of Pig (Die game) that I'm writing Code for
By nwbaldi in forum New To JavaReplies: 4Last Post: 07-08-2012, 10:07 AM -
Pig Game code gone wrong! Help please.
By GoodThing007 in forum New To JavaReplies: 6Last Post: 12-05-2011, 02:24 AM -
dice game code creating help!
By singingglue in forum New To JavaReplies: 17Last Post: 11-22-2011, 03:34 AM -
game code for any game
By deathnote202 in forum Java GamingReplies: 4Last Post: 06-10-2010, 09:06 AM -
Breakout Game code help.
By Ceasar in forum New To JavaReplies: 6Last Post: 10-10-2009, 02:30 AM
Bookmarks