Animated Smileys - Implementing Graphics
and Turning the Application into an Applet

Lab Assignment 3

In Lab Assignment 2, we provided the graphics routines that built the bouncing display and the graphics frame that holds it, and that drew the smileys, frame by frame in that display, to show the bouncing smiley faces. In this assignment, you first write those graphics routines, providing you practice not only with Java's basic graphic capabilities, but also with inner classes, and the properties of inheritance and polymorphism. Then you write a class that allows you do the same animation as an applet, an application called from another environment, in this case from an applet viewer within Eclipse. A correctly written applets can be called from a page--we'll show in lecture how this is done (it's simpler than you might think!), but it is not required for this assignment.


Pair Programming

You are required to pair program for this assignment


Part I - Replicate the Graphics Routines of Lab Assignment 2

Program Behavior and General Requirements

...is the same as Lab Assignment 2. We trust that is no surprise; in this assigment you are just swapping out provided classes for ones that you write. (This happens a fair amount with real software systems: when a better way is found to accomplish the requirements of a class, that class is revised or rewritten -- provided the resources spent doing so produces benefits worth the cost.)

Technical Details

Again we provide outlines of the classes you are to write (BouncingFrame and BouncingDisplay) with lots of comments and suggestions to guide you in meeting the public methods' requirements and with writing the private class items (methods, constants, fields) to support them. For classes that you use as provided, we again provide a text file for each that describes its publicly available methods and constants. (Some classes we provide are needed only for purposes of inheritance. We provide no documentation file for those classes—whatever methods you might need from these base classes will be documented in the classes that inherit them.)


Part II - Convert This Application to an Applet

Program Behavior and General Requirements

...the same as above, except the program runs as an applet launched via Eclipse's applet viewer.

Technical Details

We provide the outline of the applet class, BouncingSmileysApplet.java, which replaces (and performs the tasks equivalent to) the BoucingDisplay and BouncingFrame classes‐they are not appropriate because the applet window is used to display the graphics—and SmileyAnimaton—because that class animates smileys within a BouncingDisplay, which, with an applet, we do not have. BouncingSmileysApplet.java sets the attributes of the display window and makes the smileys bounce around within it. If done right, you will not have to modify any other class to make this applet function correctly. You should also find that much of the code, perhaps with slight revision, from SmileyAnimation and BouncingDisplay, can be used in writing it.

To run the applet, highlight BouncingSmileysApplet.java in the Package Explorer window and then choose Run from the Run menu; Eclipse will know this file is an applet and fire it up with its applet viewer.

As before, all these files have been collected into an Eclipse project and zipped into an archive; this one is called Lab3.zip. Using the same procedure that you followed in the last assignment, import this project into your Eclipse workspace.


Deliverables

Zip up your project folder into the file AnimatedSmileysGraphics.zip, and turn it in via Checkmate.


Written by Norman Jacobson for ICS 45J Fall 2012, August 2012.
Deliverables section added, by Norman Jacobson, October 2012.