Would you like to make this site your homepage? It's fast and easy...
Yes, Please make this my home page!
450 Assignment #4: Animated Applet with Widgets
animated applet "Catch a Falling Star" is the same as the applet
for Assignment#3 except it now contains a GUI interface that allows the user
to manipulate the objects in the applet. The widgets are derived from the
before, the frame rate of the applet is set with the fps a parameter
tag in the HTML file.
applet thread is controlled with the "Start" and "Stop"
buttons. "Stop" brings all motion to a halt and "Start"
allows the applet to continue.
color of the star is controlled with the choice widget. Within
this pulldown menu are a series of pre-definied color choices as well as a
choice that allows a random color to be selected. All colors, including the
one randomly selected remain until the user changes them.
the mouse pointer in the animation box will cause the top left corner
of the 3D box to move to that location. It does not alter the path
of the box in any other way.
background color for the applet is controled by the check boxes
labelled "Night" and "Day". Selecting "Night"
sets the backgrond to black. Selecting "Day" sets the background
to yellow. When the background color is changed, the FallingStarCanvas class
also changes the outline color of the star.
Source code for Animated Applet with Widgets: FallingStar2.java
an implementation perspective, the applet is now somewhat different. The Border
layout manager has been used to position the applet title, the canvas containing
the animation, and the GUI widgits that control the applet's actions. The
animation is now contained in an object that is an extension of the Canvas
class. The implementation of the animation canvas is contained in the FallingStarCanvas
class while the Layout and classes that implement the GUI widget function
are in the FallingStar2 class.