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

Class wb.GraphText

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

public class GraphText
extends GraphUnit
Text in its native form uses the xmin and ymin as the starting point xmax and ymax are not used as of NOW

Variable Index

 o data
Container for the text represented by this GraphText Object
 o fontsize
A representation of the fonsize relatively.

Constructor Index

 o GraphText(int, int, Color)
Creates a instance with the fontsize defaulted to NORMAL
 o GraphText(int, int, int, Color)
Creates a instance
 o GraphText(int, int, Color, String)
Creates a instance
 o GraphText(int, int, int, Color, String)
Creates a instance
 o GraphText(DataInputStream)
Creates an instance by reading data from the Stream.

Method Index

 o addnext(int, int)
AddNext Not used here
 o addnext(String)
AddNext
 o addnext(char)
AddNext
 o basedepacketize(DataInputStream)
Helper method that forces the data from the stream to be read into the byte array and extracts the data from the byte array to the variables.
 o basepacketize(DataOutputStream)
Helper method that packs all the data of the base class variables.
 o erase(Graphics, Color)
Actually this is no different from painting, except that it uses the back ground color and paints it in the XOR mode
 o isInside(int, int)
method to verify if the passed point is enclosed in the handles of this Object.
 o isValid()
isValid is very useful in determine'g miscellaneous objects at the time of creation.
 o packetize(DataOutputStream)
Packetizes all the information required to create an instance of this and writes it to the stream calls basepacketize to packetize the base class variables and the packs variables of this and then sync's the data to the stream.
 o paint(Graphics)
the Heart of rendering.

Variables

 o data
  protected StringBuffer data
Container for the text represented by this GraphText Object
 o fontsize
  protected int fontsize
A representation of the fonsize relatively. Question of the the existance of absolute fontsize on a specific platform is unanswered defaults to NORMAL (in this implementation to 14pt)

Constructors

 o GraphText
  public GraphText(int x,
                   int y,
                   Color arg)
Creates a instance with the fontsize defaulted to NORMAL
Parameters:
x - the x coordinate of the starting point
y - the y coordinate of the starting point
arg - the Color of this text
 o GraphText
  public GraphText(int x,
                   int y,
                   int fsize,
                   Color arg)
Creates a instance
Parameters:
x - the x coordinate of the starting point
y - the y coordinate of the starting point
fsize - the fontsize constant could be NORMAL, BIG, SMALL
arg - the Color of this text
 o GraphText
  public GraphText(int x,
                   int y,
                   Color arg,
                   String chardata)
Creates a instance
Parameters:
x - the x coordinate of the starting point
y - the y coordinate of the starting point
arg - the Color of this text
chardata - the String
 o GraphText
  public GraphText(int x,
                   int y,
                   int fsize,
                   Color arg,
                   String chardata)
Creates a instance
Parameters:
x - the x coordinate of the starting point
y - the y coordinate of the starting point
fsize - the fontsize constant could be NORMAL, BIG, SMALL
arg - the Color of this text
chardata - the String
 o GraphText
  public GraphText(DataInputStream din) throws IOException
Creates an instance by reading data from the Stream.
Throws: IOException
if reading the stream fails

Methods

 o basedepacketize
  protected void basedepacketize(DataInputStream din) throws IOException
Helper method that forces the data from the stream to be read into the byte array and extracts the data from the byte array to the variables.
Parameters:
din - the DataInputStream from which data is read
Throws: IOException
if an I/O error has occurred.
Overrides:
basedepacketize in class GraphUnit
 o basepacketize
  protected void basepacketize(DataOutputStream dos) throws IOException
Helper method that packs all the data of the base class variables. into a byte array (BytePackOutputStream)
Parameters:
dos - the DataOutputStream from into which data is written
Throws: IOException
if an I/O error has occurred.
Overrides:
basepacketize in class GraphUnit
 o packetize
  public void packetize(DataOutputStream dos) throws IOException
Packetizes all the information required to create an instance of this and writes it to the stream calls basepacketize to packetize the base class variables and the packs variables of this and then sync's the data to the stream. This method enables data to be written in blocks.
Parameters:
dos - the DataOutputStream from into which data is written
Throws: IOException
if an I/O error has occurred.
Overrides:
packetize in class GraphUnit
 o addnext
  public void addnext(int x,
                      int y)
AddNext Not used here
Parameters:
x - the x-coordinate
y - the y-coordinate
Overrides:
addnext in class GraphUnit
 o addnext
  public void addnext(String chardata)
AddNext
Parameters:
chardata - the string that is to be appended to the existing text
Overrides:
addnext in class GraphUnit
 o addnext
  public void addnext(char x)
AddNext
Parameters:
x - the char that is appended to the existing text
Overrides:
addnext in class GraphUnit
 o paint
  public void paint(Graphics g)
the Heart of rendering. It is called to update/paint the canvas set the graphics appropriately with the font, color etc.
Parameters:
g - Graphics on to which this is rendered
Overrides:
paint in class GraphUnit
 o erase
  public void erase(Graphics g,
                    Color arg)
Actually this is no different from painting, except that it uses the back ground color and paints it in the XOR mode
Parameters:
g - Graphics on to which this is rendered
arg - Color the background
Overrides:
erase in class GraphUnit
 o isValid
  public boolean isValid()
isValid is very useful in determine'g miscellaneous objects at the time of creation.
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