Results 1 to 4 of 4
  1. #1
    TheSheepey9 is offline Member
    Join Date
    Feb 2013
    Posts
    2
    Rep Power
    0

    Default 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.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default 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.

  3. #3
    TheSheepey9 is offline Member
    Join Date
    Feb 2013
    Posts
    2
    Rep Power
    0

    Default Re: 2D Game Code Help

    Sweet.
    Thank you!

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Replies: 4
    Last Post: 07-08-2012, 10:07 AM
  2. Pig Game code gone wrong! Help please.
    By GoodThing007 in forum New To Java
    Replies: 6
    Last Post: 12-05-2011, 02:24 AM
  3. dice game code creating help!
    By singingglue in forum New To Java
    Replies: 17
    Last Post: 11-22-2011, 03:34 AM
  4. game code for any game
    By deathnote202 in forum Java Gaming
    Replies: 4
    Last Post: 06-10-2010, 09:06 AM
  5. Breakout Game code help.
    By Ceasar in forum New To Java
    Replies: 6
    Last Post: 10-10-2009, 02:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •