Class Text

Class Text

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

public class Text
extends ObjBaseClass
implements DrawObject, Cloneable

Variable Index

 o baseColors
 o color
 o dist_x
 o dist_y
 o height
 o obj_id
 o old_x1
 o old_y1
 o text
 o type
 o width
 o x1
 o y1

Constructor Index

 o Text(SketchArea)
constructor
 o Text(SketchArea, String, Dimension)
constructor
 o Text(SketchArea, String, int, FontMetrics)
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 text object by making an exact copy of this text object with values equal to the original values, except that the starting and ending points of the newly cloned text 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 getStringDim(String, FontMetrics)
Gets dimension of the string entered onto the textfield of the whiteboard canvas.
 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 setBaseDist(Graphics, int, int)
 o setBasePoint(int, int)
 o setPenColor(Graphics, int)
set drawing color

Variables

 o x1
  public int x1
 o y1
  public int y1
 o width
  public int width
 o height
  public int height
 o old_x1
  public int old_x1
 o old_y1
  public int old_y1
 o dist_x
  public int dist_x
 o dist_y
  public int dist_y
 o text
  public String text
 o type
  public int type
 o color
  public int color
 o baseColors
  public Color baseColors[]
 o obj_id
  public int obj_id

Constructors

 o Text
  public Text(SketchArea parent,
              String text,
              int c,
              FontMetrics fm)
constructor
Parameters:
parent - SketchArea object reference
c - color type
Returns:
none
 o Text
  public Text(SketchArea parent,
              String text,
              Dimension dim)
constructor
Parameters:
parent - SketchArea reference
Returns:
none
 o Text
  public Text(SketchArea parent)
constructor
Parameters:
parent - SketchArea reference
Returns:
none

Methods

 o getStringDim
  public Dimension getStringDim(String text,
                                FontMetrics fm)
Gets dimension of the string entered onto the textfield of the whiteboard canvas.
Parameters:
text - text entered
Returns:
s dimension of the text entered
 o clone
  public Object clone()
clones a text object by making an exact copy of this text object with values equal to the original values, except that the starting and ending points of the newly cloned text are translated by a value of TRANSLATE_X and TRANSLATE_Y defined in the ObjBaseClass.java.
Returns:
a cloned text 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. This event is not relevant to this class of text string objects. The event is not implemented though it's being declared due to compliance to the interface DrawObject.
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. Not relevant and hence not implemented though declared due to compliance to the interface DrawObject.
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 setBasePoint
  public void setBasePoint(int x,
                           int y)
 o setBaseDist
  public void setBaseDist(Graphics g,
                          int x,
                          int y)
 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()