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
-
o
- The outbound message stream.
-
oX
- The x coordinate of the last mouse action.
-
oY
- The y coordinate of the last mouse action.
-
Whiteboard()
- Creates a new Whiteboard with an off-white background.
-
disconnected()
- Disconnects this tool; in this case, sets the drawing Color
to red.
-
mouseDown(Event, int, int)
- The mouse button has been pressed; transmit the coordinates.
-
mouseDrag(Event, int, int)
- The mouse has been dragged; draw a segment to the screen and
transmit the coordinates.
-
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.
-
preferredSize()
- Returns the preferred size of this component.
-
receive(DataInputStream)
- Receives a message from a peer Whiteboard.
-
scribble(int, int)
- Draws a line segment to the screen between oX, oY
and the new coordinates.
-
setMessageOutput(MessageOutput)
- Assigns a message output stream over which this tool
can communicate.
-
transmit(int, int)
- Transmits new coordinates to the message stream, and assigns new values
to oX and oY.
o
protected MessageOutput o
- The outbound message stream.
oX
protected int oX
- The x coordinate of the last mouse action.
oY
protected int oY
- The y coordinate of the last mouse action.
Whiteboard
public Whiteboard()
- Creates a new Whiteboard with an off-white background.
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
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
disconnected
public void disconnected()
- Disconnects this tool; in this case, sets the drawing Color
to red.
preferredSize
public Dimension preferredSize()
- Returns the preferred size of this component.
- Overrides:
- preferredSize in class Component
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
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
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
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
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