|
Most of the user interactions will
take place in this applet. Initially when it is loaded and
started, nothing is visible thus disabling the user from
doing anything useful on this applet. After a beach is selected
from the map on BeachMap applet,
then the fun begins.
As a result, a MapData object is
passed to it. Before doing anything with the data, a data
validation is carried out to make sure the data is valid.
If everything is OK, then the data is processed.
If more than one picture exists they
are displayed one after another with delay in between them
(animation). This process is controlled by a separate thread
of execution so that the applet can carry other tasks too
such as playing the sound clip or waiting to events to occur.
BeachInfo class extends from the
Applet class. To view the inheritance hierarchy, go to the
Inheritance and Collaboration
section. Furthermore it implements three interfaces, they
are the MouseListener interface, ActionListener and Runnable.
To enable itself to receive
mouse events such as mouse clicks, it implements the MouseListener.
This interface defines the signature of the methods that
must be implemented by the BeachInfo applet. Only one component
of BeachInfo applet is interested in capturing the mouse
clicks, the canvas where the picture(s) are displayed. When
a mouse click is detected, the BeachInfo is informed about
the event. As the result the animation is suspended or resumed
depending the on the current status of the thread.
|