Class Line

Class Line

java.lang.Object
   |
   +----ObjBaseClass
           |
           +----Line

public class Line
extends ObjBaseClass
implements DrawObject, Cloneable

Variable Index

 o baseColors
 o color
 o obj_id
 o old_x
 o old_y
 o type
 o x1
 o x2
 o y1
 o y2

Constructor Index

 o Line(SketchArea)
constructor
 o Line(SketchArea, int)
constructor

Method Index

 o assemble(int)
assembles the Line object's parameters based on application-specific format before calling superclass's BaseClassAssemble for assembling this resulting packet with the RTP header.
 o clean(Graphics)
 o clear(Graphics)
clear up object on the whiteboard
 o clone()
clones a line object by making an exact copy of this line object with values equal to the original values, except that the starting and ending points of the newly cloned line are translated by a value of TRANSLATE_X and TRANSLATE_Y defined in the ObjBaseClass.java.
 o draw(int, int, int, int, int, int)
draw object which is passed from network
 o erase(Graphics, boolean)
 o getObjID()
 o getType()
return type of the object
 o mouseDown(int, int)
event handler for mouse down while drawing
 o mouseDrag(int, int)
event handler for mouse drag when drawing the objects
 o mouseUp(int, int)
event handler for mouse up when drawing objects
 o moveUP(Graphics, int, int)
set parameter after locating the last point
 o moving(Graphics, int, int)
function called when moving the object
 o paint(Graphics)
draw the object by pen color
 o processInData(byte[])
retrieves Line object's parameters from the received packet and display the line on the drawing canvas of the whiteboard.
 o recvd_moved_obj(Graphics, int, int, int, int)
 o send()
 o setPenColor(Graphics, int)
set drawing color

Variables

 o x1
  public int x1
 o y1
  public int y1
 o old_x
  public int old_x
 o old_y
  public int old_y
 o x2
  public int x2
 o y2
  public int y2
 o type
  public int type
 o color
  public int color
 o baseColors
  public Color baseColors[]
 o obj_id
  public int obj_id

Constructors

 o Line
  public Line(SketchArea parent,
              int c)
constructor
Parameters:
parent - SketchArea object reference
c - color type
Returns:
none
 o Line
  public Line(SketchArea parent)
constructor
Parameters:
parent - SketchArea reference
Returns:
none

Methods

 o clone
  public Object clone()
clones a line object by making an exact copy of this line object with values equal to the original values, except that the starting and ending points of the newly cloned line are translated by a value of TRANSLATE_X and TRANSLATE_Y defined in the ObjBaseClass.java.
Returns:
a cloned object.
Overrides:
clone in class Object
 o mouseDown
  public boolean mouseDown(int x,
                           int y)
event handler for mouse down while drawing
Parameters:
x - x value
y - y value
Returns:
true
 o mouseUp
  public boolean mouseUp(int x,
                         int y)
event handler for mouse up when drawing objects
Parameters:
x - x value
y - y value
Returns:
true
 o send
  public void send()
 o mouseDrag
  public boolean mouseDrag(int x,
                           int y)
event handler for mouse drag when drawing the objects
Parameters:
x - x value
y - y value
Returns:
true
 o moving
  public void moving(Graphics g,
                     int x,
                     int y)
function called when moving the object
Parameters:
x - x value
y - y value
Returns:
void
 o recvd_moved_obj
  public void recvd_moved_obj(Graphics g,
                              int recvd_x1,
                              int recvd_y1,
                              int recvd_x2,
                              int recvd_y2)
 o moveUP
  public void moveUP(Graphics g,
                     int x,
                     int y)
set parameter after locating the last point
Parameters:
g - graphics context
x - x value
Returns:
y y value
 o setPenColor
  public void setPenColor(Graphics g,
                          int c)
set drawing color
Parameters:
g - graphics context
c - color
Returns:
void
 o draw
  public void draw(int xx1,
                   int yy1,
                   int xx2,
                   int yy2,
                   int col,
                   int obj_id_recvd)
draw object which is passed from network
Parameters:
xx1 - start point
yy1 - start point
xx2 - end point
yy2 - end point
Returns:
void
 o paint
  public void paint(Graphics g)
draw the object by pen color
Parameters:
g - graphics context
Returns:
void
 o clear
  public void clear(Graphics g)
clear up object on the whiteboard
Parameters:
g - Graphics context
Returns:
void
 o clean
  public void clean(Graphics g)
 o erase
  public void erase(Graphics g,
                    boolean send_del_req)
 o assemble
  public void assemble(int ObjectType)
assembles the Line object's parameters based on application-specific format before calling superclass's BaseClassAssemble for assembling this resulting packet with the RTP header. This function is called by mouseUp Event.
Returns:
void
 o processInData
  public void processInData(byte buf[])
retrieves Line object's parameters from the received packet and display the line on the drawing canvas of the whiteboard.
Parameters:
buf - buffer that holds parameters in the form of byte array.
Returns:
void
 o getType
  public int getType()
return type of the object
Returns:
type
 o getObjID
  public int getObjID()