954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

problems with running applet as application

this is the source code http://www.bennychow.com/download/pacman_eclipse_project.zip
works as an applet
but I want to create tests (its due tomorrow :/) for this app and in order to do that I need to run it as an application
so I created a main method:

public static void main(String[] args) {
			PacMan pacMan = new PacMan();
			pacMan.init();
			pacMan.start();
			JFrame window = new JFrame("Sample Applet and Application");
	        window.setContentPane(pacMan);
	        window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	        window.pack();              // Arrange the components.
	        //System.out.println(theApplet.getSize());
	        window.setVisible(true);    // Make the window visible.
		}


but with this main method i get exceptions that i didnt get when i was running it as an applet any ideas what I need to do in order to solve this?

thanks to all helpers.

dentoo
Newbie Poster
1 post since Dec 2009
Reputation Points: 10
Solved Threads: 0
 

to accomplish your task instead of extending your class to Applet go for Frame(in PackMan.java)....
this will do .....

james chaco
Light Poster
33 posts since Sep 2008
Reputation Points: 10
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You