CSE 131 Module 10: Class Hierarchies

Bridges


Bridge or Extension: Programming Contest

Completing this work will count as a bridge or as an extension (but not both). You will be credited for whichever raises your grade most.

This bridge provides an opportunity for you to modify your game and put it on the web as an applet for the CSE131 Programming Contest. This document provides information on how to make an applet out of your application and how to enter it in the programming contest. To get credit, you need only enter the contest with a credible solution...you don't need to win! (Although there will be some cool prizes.)


Making an applet out of your application

All of the following steps, up to the horizontal line, can be done on whatever platform you have been developing your code.

Make the following simple modification to the Main class.
From the applet, we need access to the NIP instance. this is most easily achieved by editing the region near the bottom of Main so that it looks like the following:
	public static NIP nip;   // add this line

	public static void main(String args[]) {
		nip = new NIP(512, 512);  // this line is changed
		Main m = new Main();
		m.controller = new Controller(nip.getTargetPanel());
		nip.setTool(m);
	}
Simply copy and paste the above code in place of the main method that you currently have in Main.

Create a MyApplet class.
Try running your applet under eclipse
Right-click on the MyApplet class in the package explorer, drag down to Run As... and choose Java Applet.
Your program should run as it did before. If not, get help, because the rest of the steps won't work.
Generate a jar file that contains all of your code and pictures
Once you can successfully run as an applet under eclipse, then

The following steps must be done on a cec computer. You can come to the lab to do this, or you can remote-desktop (on Windows, this is from All Programs...Accessories...Remote Desktop) to mirage.cec.wustl.edu. The steps below generally assume that you are using Windows, but you are welcome to use whatever steps you can to create the structures needed.

We will be available during help sessions and lab hours to work with you on this.


Now try to run your game from a web browser.
The browser must be able to run 1.6 Java code, or you will be taken to a page to install the Java plugin. The cec computers (but not mirage as of this writing, but soon) can run the applet fine.
Using IE or Firefox or whatever, open the following URL:
http://userfs.cec.wustl.edu/~YOURUSERNAME/
This opens the page you created, which should display in the browser, launch your applet, and then cause your game to run in yet another window.
If you send the URL to your friends or family, they can run your applet too!

Submitting your bridge and entering the contest

Follow these instructions carefully! Only one entry should be provided per group submitting to the bridge/extension/programming contest.