Class prominence.chat.Whiteboard
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class prominence.chat.Whiteboard

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----prominence.chat.Whiteboard

public class Whiteboard
extends Canvas
implements Client
A whiteboard tool; this is a Canvas that implements the Client interface, and is added to the Chat Frame. Drawings from other clients are displayed on the Canvas.
See Also:
Client, Chat

Variable Index

 o o
The outbound message stream.
 o oX
The x coordinate of the last mouse action.
 o oY
The y coordinate of the last mouse action.

Constructor Index

 o Whiteboard()
Creates a new Whiteboard with an off-white background.

Method Index

 o disconnected()
Disconnects this tool; in this case, sets the drawing Color to red.
 o mouseDown(Event, int, int)
The mouse button has been pressed; transmit the coordinates.
 o mouseDrag(Event, int, int)
The mouse has been dragged; draw a segment to the screen and transmit the coordinates.
 o mouseUp(Event, int, int)
The mouse button has been released; draw the last segment to the screen, transmit the coordinates and send the complete message.
 o preferredSize()
Returns the preferred size of this component.
 o receive(DataInputStream)
Receives a message from a peer Whiteboard.
 o scribble(int, int)
Draws a line segment to the screen between oX, oY and the new coordinates.
 o setMessageOutput(MessageOutput)
Assigns a message output stream over which this tool can communicate.
 o transmit(int, int)
Transmits new coordinates to the message stream, and assigns new values to oX and oY.

Variables

 o o
  protected MessageOutput o
The outbound message stream.
 o oX
  protected int oX
The x coordinate of the last mouse action.
 o oY
  protected int oY
The y coordinate of the last mouse action.

Constructors

 o Whiteboard
  public Whiteboard()
Creates a new Whiteboard with an off-white background.

Methods

 o setMessageOutput
  public void setMessageOutput(MessageOutput o)
Assigns a message output stream over which this tool can communicate. This method is called by the GenericClient class with a message stream that is multiplexed to peer Whiteboard's of other clients.
Parameters:
o - The message output stream
See Also:
GenericClient
 o receive
  public void receive(DataInputStream dI)
Receives a message from a peer Whiteboard.
Parameters:
dI - A stream from which the message can be read.
See Also:
receive
 o disconnected
  public void disconnected()
Disconnects this tool; in this case, sets the drawing Color to red.
 o preferredSize
  public Dimension preferredSize()
Returns the preferred size of this component.
Overrides:
preferredSize in class Component
 o mouseDown
  public boolean mouseDown(Event e,
                           int x,
                           int y)
The mouse button has been pressed; transmit the coordinates.
Overrides:
mouseDown in class Component
See Also:
transmit
 o mouseDrag
  public boolean mouseDrag(Event e,
                           int x,
                           int y)
The mouse has been dragged; draw a segment to the screen and transmit the coordinates.
Overrides:
mouseDrag in class Component
See Also:
scribble, transmit
 o mouseUp
  public boolean mouseUp(Event e,
                         int x,
                         int y)
The mouse button has been released; draw the last segment to the screen, transmit the coordinates and send the complete message.
Overrides:
mouseUp in class Component
See Also:
scribble, transmit
 o transmit
  protected void transmit(int x,
                          int y)
Transmits new coordinates to the message stream, and assigns new values to oX and oY.
Parameters:
x - The x mouse coordinate
y - The y mouse coordinate
 o scribble
  protected void scribble(int x,
                          int y)
Draws a line segment to the screen between oX, oY and the new coordinates.
Parameters:
x - The x mouse coodinate
y - the y mouse coordinate

All Packages  Class Hierarchy  This Package  Previous  Next  Index