Next: Conclusions
Up: Implementation of Relay and
Previous: Notification of Changes to
The Multiart client is designed as a Java applet using the Java AWT for
graphics and user interaction. Being a Java applet, Multiart
can be downloaded and run in a Java compliant web browser. Unfortunately, no
web browser currently supports object serialization. For now, Multiart
must be run using Sun's appletviewer application.
Multiart uses the Java AWT to draw its user interface and to respond to users'
actions. The following is a list of the Java applet methods used by
Multiart:
- public void init() - This method instantiates the Relay cache
object and draws the Multiart GUI. The GUI consists of a toolbar of
buttons and canvas for drawing. The toolbar has buttons for choosing a
drawing mode. The four drawing modes are pointer, line, oval, and
rectangle.
- public boolean mouseDown(Event evt, int x, int y) - Called
when the user clicks down on the mouse, this method's action depends on the
current drawing mode. When the current drawing mode is pointer, clicking
the mouse on an existing figure will select the figure for updating. In
all other modes, clicking the mouse marks one corner for drawing a new
figure.
- public boolean mouseDrag(Event evt, int x, int y) - The
mouseDrag method draws an outline of the new or updated figure as the user
holds down the mouse button and drags the mouse.
- public boolean mouseUp(Event evt, int x, int y) - This method
is called when a user releases the mouse button. It completes the process
of updating shared state by notifying the Relay cache that an update has
occurred. An object reference to the new or updated figure is passed as the
argument to updateCache(Cacheable c) to enter the update into the
Relay system.
As required, the Multiart client implements the java.util.Observer
interface so it can be notified of changes to the Relay cache. Multiart's
implementation of the Observer.update(Observable o, Object o) method
simply repaints the objects in the cache to reflect any new state.
Figure 4.3: Snapshot of Multiart GUI
Next: Conclusions
Up: Implementation of Relay and
Previous: Notification of Changes to
Carmine F. Greco
Wed Mar 26 23:44:38 EST 1997