Class wb.GFreeHand
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class wb.GFreeHand

java.lang.Object
   |
   +----wb.GraphUnit
           |
           +----wb.GFreeHand

public class GFreeHand
extends GraphUnit
PolyLine in its native form Maps the base class member variables (xmin, ymin) as the starting point (xmax or ymax) --> the number of points in the polygon Limit to a max of 400 points

Variable Index

 o xpoints
Array of integer to hold the x-coordinates of the remaining points
 o ypoints
Array of integer to hold the y-coordinates of the remaining points

Constructor Index

 o GFreeHand(int, int, Color)
Creates an Instance of FreeHand Line with its first point set along with the Color and type
 o GFreeHand(DataInputStream)
Creates an instance of the GFreeHand by reading the data from the Input Stream.

Method Index

 o addnext(int, int)
Method to add the next point of the polyline
 o basedepacketize(DataInputStream)
Helper method to unpack the data from byte array and place fill the member variables.
 o erase(Graphics, Color)
Paints the object using the background color to the canvas/screen
 o isInside(int, int)
method to verify if the passed point is enclosed in the handles of this Object.
 o isValid()
Provides a method to verify if the current object is valid either for transportation or rendering
 o packetize(DataOutputStream)
method for Object transport.
 o paint(Graphics)
Does the real work of painting the object to the canvas/screen

Variables

 o xpoints
  protected int xpoints[]
Array of integer to hold the x-coordinates of the remaining points
 o ypoints
  protected int ypoints[]
Array of integer to hold the y-coordinates of the remaining points

Constructors

 o GFreeHand
  public GFreeHand(int x,
                   int y,
                   Color arg)
Creates an Instance of FreeHand Line with its first point set along with the Color and type
Parameters:
x1 - the x coordinate of the first point
y1 - the y coordinate of the first point
arg - the color of this rectangle.
See Also:
addnext, GTypes
 o GFreeHand
  public GFreeHand(DataInputStream din) throws IOException
Creates an instance of the GFreeHand by reading the data from the Input Stream. It then fills up the member variables of the class
Parameters:
din - DataInputStream the stream from which the data is read
Throws: IOException
if an I/O error occurs
See Also:
ByteUnPackInputStream, packetize

Methods

 o basedepacketize
  protected void basedepacketize(DataInputStream din) throws IOException
Helper method to unpack the data from byte array and place fill the member variables.
Parameters:
din - the stream from which it reads the data
Throws: IOException
if an I/O error occurs
Overrides:
basedepacketize in class GraphUnit
See Also:
basepacketize, ByteUnPackInputStream
 o packetize
  public void packetize(DataOutputStream dos) throws IOException
method for Object transport.
Parameters:
dos, - DataOutputStream to which the data is to be written.
Throws: IOException,
throws IOException when there is a read error
Overrides:
packetize in class GraphUnit
See Also:
basedepacketize, basepacketize, packetize, BytePackOututStream
 o addnext
  public void addnext(int x,
                      int y)
Method to add the next point of the polyline
Parameters:
x - the x-coordinate of the (next)point
y - the y-coordinate of the (next)point
Overrides:
addnext in class GraphUnit
 o paint
  public void paint(Graphics g)
Does the real work of painting the object to the canvas/screen
Parameters:
g - Graphics on to which the object is rendered
Overrides:
paint in class GraphUnit
 o erase
  public void erase(Graphics g,
                    Color arg)
Paints the object using the background color to the canvas/screen
Parameters:
g - Graphics on to which the object is rendered
arg - Color of the background
Overrides:
erase in class GraphUnit
See Also:
erase
 o isValid
  public boolean isValid()
Provides a method to verify if the current object is valid either for transportation or rendering
Returns:
boolean true if the number of points is more than 1 else false
Overrides:
isValid in class GraphUnit
 o isInside
  public boolean isInside(int x,
                          int y)
method to verify if the passed point is enclosed in the handles of this Object.
Parameters:
x - x-coordinate of the point
y - y-coordinate of the point
Returns:
boolean true iff the point is enclosed in the handles
Overrides:
isInside in class GraphUnit

All Packages  Class Hierarchy  This Package  Previous  Next  Index