Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

loading asteroids code into jbuilder

Options
  • 06-02-2004 2:00pm
    #1
    Closed Accounts Posts: 7,134 ✭✭✭


    hi folks

    i got some code which i want to load into jbuilder 9. its from a asteroids game, i cant get a main class loaded. ?

    +-

    here is a snap shot of the files i got in winzip unpacked.

    your help is appreciated!

    Ezza

    :)


Comments

  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    Its probably an embedded applet not an application.


  • Registered Users Posts: 1,994 ✭✭✭lynchie


    There is no main method because it is an applet. Look at Sun's website for information on applets.

    You should be able to add your own main method within the code to instanciate the applet and call its init method.


  • Closed Accounts Posts: 7,134 ✭✭✭x in the city


    sorry but ihave no idea how to implement a main method onto an applet,. sound rather too much for me.....!



    can anyone give some basic steps how i could do this?


  • Registered Users Posts: 885 ✭✭✭clearz


    At the beginning of the class if it says extends Applet change it to extends Frame. if it says extends JApplet change it to extends JFrame

    the method called public void init() should be changed to public Asteroids() without the void bit. Inside this method at the end add setSize(500,500); setVisible(true);

    add this method to the class :

    public static void main(String[] args)
    {
    new Asteroids()'
    }


Advertisement