Class SketchArea
Class SketchArea
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----SketchArea
- public class SketchArea
- extends Canvas
-
GC
-
-
moveObj
-
-
objToMove
-
-
offscreenG
-
-
offscreenImg
-
-
selectedObj
-
-
addStack(Object)
- add one object to the stack
-
erase_recvd_obj(int)
- searches through the stack to find the correct object to be deleted
following the remote DELETE request.
-
insets()
- set border width
-
isCircle(DrawObject, int, int)
- Checks whether desired object from the stack is a Circle object.
-
isLine(DrawObject, int, int)
- Checks whether desired object from the stack is a Line object.
-
isOval(DrawObject, int, int)
- Checks whether desired object from the stack is an Oval object.
-
isRect(DrawObject, int, int)
- Checks whether desired object from the stack is a Rectangle.
-
isText(DrawObject, int, int)
- Checks whether desired object from the stack is a Text object.
-
mouseDown(Event, int, int)
- event handler for mouse down
-
mouseDrag(Event, int, int)
- event handler for mouse drag
-
mouseUp(Event, int, int)
- event handler for house up
-
moveObj(DrawObject, DataInputStream)
-
-
paint(Graphics)
- member function to handle exposure event and create offscreen buffer
-
paste(DrawObject)
- pastes objects from the clipboard.
-
proc_obj(byte[], int)
- dispatches object to either the method to move or delete the object,
based on the requestType.
-
processInData(byte[])
- process data passed from network, the data contains essential parameter for
various drawing objects
-
proctextfield(int, int, int, String)
- Processes text , if any, entered into the textfield, when
mouseDown event has occurred.
-
update_moved_obj(int, byte[])
- Updates the object whenever this object has been moved remotely.
-
update_obj_params(Object, DataInputStream, Graphics)
-
offscreenImg
public Image offscreenImg
GC
public Graphics GC
offscreenG
public Graphics offscreenG
moveObj
public Object moveObj
objToMove
public DrawObject objToMove
selectedObj
public DrawObject selectedObj
insets
public Insets insets()
- set border width
- Returns:
- Insets
paint
public void paint(Graphics g)
- member function to handle exposure event and create offscreen buffer
- Parameters:
- g - graphics context
- Returns:
- void
- Overrides:
- paint in class Canvas
paste
public void paste(DrawObject objToPaste)
- pastes objects from the clipboard.
- Parameters:
- objToPaste - object from the clipboard
mouseDown
public boolean mouseDown(Event e,
int x,
int y)
- event handler for mouse down
- Parameters:
- e - event instance
- x - x value
- y - y value
- Returns:
- true
- Overrides:
- mouseDown in class Component
proctextfield
public void proctextfield(int x,
int y,
int color,
String textStr)
- Processes text , if any, entered into the textfield, when
mouseDown event has occurred.
- Parameters:
- x - x coordinate of mouseDown event.
- y - y coordinate of mouseDown event.
- color - color of text entered.
mouseUp
public boolean mouseUp(Event e,
int x,
int y)
- event handler for house up
- Parameters:
- e - event instance
- x - x value
- y - y value
- Returns:
- true
- Overrides:
- mouseUp in class Component
isLine
public boolean isLine(DrawObject top,
int x,
int y)
- Checks whether desired object from the stack is a Line object.
- Parameters:
- top - topmost object on the graphics object stack.
- x - x coordinate of mouse event.
- y - y coordinate of mouse event.
- Returns:
- true when selected object is a line.
isRect
public boolean isRect(DrawObject top,
int x,
int y)
- Checks whether desired object from the stack is a Rectangle.
- Parameters:
- top - topmost object on the graphics object stack.
- x - x coordinate of mouse event.
- y - y coordinate of mouse event.
- Returns:
- true when selected object is a rectangle.
isCircle
public boolean isCircle(DrawObject top,
int x,
int y)
- Checks whether desired object from the stack is a Circle object.
- Parameters:
- top - topmost object on the graphics object stack.
- x - x coordinate of mouse event.
- y - y coordinate of mouse event.
- Returns:
- true when selected object is a circle.
isOval
public boolean isOval(DrawObject top,
int x,
int y)
- Checks whether desired object from the stack is an Oval object.
- Parameters:
- top - topmost object on the graphics object stack.
- x - x coordinate of mouse event.
- y - y coordinate of mouse event.
- Returns:
- true when selected object is a oval.
isText
public boolean isText(DrawObject top,
int x,
int y)
- Checks whether desired object from the stack is a Text object.
- Parameters:
- top - topmost object on the graphics object stack.
- x - x coordinate of mouse event.
- y - y coordinate of mouse event.
- Returns:
- true when selected object is a text string.
mouseDrag
public boolean mouseDrag(Event e,
int x,
int y)
- event handler for mouse drag
- Parameters:
- e - event type
- x - x value
- y - y value
- Returns:
- true
- Overrides:
- mouseDrag in class Component
processInData
public void processInData(byte buf[])
- process data passed from network, the data contains essential parameter for
various drawing objects
- Parameters:
- buf - buffer in bytes to hold the parameters
- Returns:
- void
proc_obj
public void proc_obj(byte obj_buf[],
int requestType)
- dispatches object to either the method to move or delete the object,
based on the requestType. The requestType is either a MOVE or
DELETE request.
- Parameters:
- obj_buf - buffer holding the object ID and object parameters
- requestType - a MOVE or DELETE request
update_moved_obj
public void update_moved_obj(int obj_id,
byte buf[])
- Updates the object whenever this object has been moved remotely.
Function will search through the stack again for every movement
of the remote object if and only if this object wasn't previously
moved object. Otherwise, it will not need to search the whole
stack, thus improving response time.
- Parameters:
- obj_id - object ID of the object to be updated.
- buf - buffer holding the object parameters.
moveObj
public void moveObj(DrawObject top,
DataInputStream dataStream)
update_obj_params
public void update_obj_params(Object ObjectType,
DataInputStream dataStream,
Graphics offscreenG)
erase_recvd_obj
public void erase_recvd_obj(int obj_id)
- searches through the stack to find the correct object to be deleted
following the remote DELETE request. Called by proc_del_obj function
that passes to it the object ID to identify the object to be deleted.
- Parameters:
- obj_id - object ID to identify the object from the stack to be
deleted.
- Returns:
- void
addStack
public void addStack(Object theObj)
- add one object to the stack
- Parameters:
- theObj - object reference
- Returns:
- void