Homer want DONUT!
Key Bindings: up = 'w', down = 's', left = 'a', right = 'd'
Instructions to Get This Working in Eclipse
If you just download the source and add it to a new project like we have
been doing, then you'll notice that the images do not load. This is
because I'm not using absolute URL's to refer to their location
(which is here, on the cs.uc.edu webserver). This is
fine for applets, but for the images to load when you run your applet
in Eclipse, you'll have to do the following...
- Create a new Java Project called HomerWantDonut
- Add a new Java Class file called HomerWantDonut
- Copy-n-Paste the source code from here into your new file:
HomerWantDonut.java
- Next, right-click each of the images below and save them to
your Desktop.
- Then, in the Package Explorer window, right-click on
the (default package) icon for this project and select
Import...
- In the menu that appears, select
General → File System.
- Browse to your Desktop directory and select the two images you just
saved there, and then click Finish.
Using this method, you can interchange the images with whatever you would
like, and even get this working from home.
Getting the Applet "Bigger" in Eclipse
You'll notice when you run this program in Eclipse, the applet is still
the normal 200 x 200 pixels... rather small. Do the following to get
the default display a bit larger...
- Make sure you have the applet working
- Then, instead of clicking the "Run" button like we normally
do...
- Click the drop-down menu to the right of the run button, and
select Run Configurations....
- In the menu that appears, click the (x) = Parameters
Tab.
- In that window, you'll see a Width: and a Height:
field.
- They are currently set to 200 each (the default). Change them to
700 (for Width) and 500 (for Height).
- Click Apply and then Run.
Images Used: