Animate:  A Java Applet that Illustrates Threads and Simple Animation

S. Tanimoto

Here is an applet that shows how simple animations can be done in a Java program. This requires a JDK1.1 compatible browser.  For example, it works under Microsoft Internet Explorer 5.0 with the Java extension.

Here are the instructions for using the applet: click on "Create Object" for each animation object you wish to create.  The maximum number is currently limited by the width of the applet, and the fact that the panel in which these objects appear is laid out with FlowLayout.  Make your drawing right on the small canvas for each animation object.  Then you may draw a trajectory for it by selecting the object with its "Select Me!" button and then dragging along a path in the central area of the applet -- the animation canvas.  When you click on "Go!" all your currently defined animation objects will follow their trajectories at the same time.  In order to erase anything in the drawings, this applet requires that you reload it (not very nice, I know!).  However, you can create a new trajectory for any object by just redrawing it.

The code for applet is available in three files:
Animate.java
AnimationObject.java
AnimationThread.java