cs015.SketchySupport
Class SketchyText

java.lang.Object
  extended byNGP.Graphics.Text
      extended bycs015.SketchySupport.SketchyText
All Implemented Interfaces:
Colorable, java.util.EventListener, Graphic, Locatable, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, Reactor, Rotatable

public class SketchyText
extends Text

A simple wrapper around the NGP.Graphics.Text class that allows for easier manipulation of location and font size.

Author:
Brent Shields

Field Summary
 
Fields inherited from interface NGP.Colorable
DEFAULT_GRAY
 
Constructor Summary
SketchyText(DrawingPanel dp, java.lang.String s)
          Create a new SketchyText object that displays the given string on the given drawing panel.
 
Method Summary
 java.awt.Dimension getDimension()
          Get the dimension of this text object.
 int getFontSize()
          Get the size of the font of this text object.
 java.awt.Point getLocation()
          Get the location of the center of this text object.
 void setFontSize(int size)
          Change the size of the font of this text object to the specified value.
 void setLocation(java.awt.Point p)
          Set the location of this text object.
 
Methods inherited from class NGP.Graphics.Text
contains, createBounds, drag, getBounds, getCenterLocation, getColor, getDrawingPanel, getFont, getRotation, getString, hide, intersects, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, paint, react, setCenterLocation, setColor, setDrawingPanel, setFont, setRotation, setString, show, unwrap, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SketchyText

public SketchyText(DrawingPanel dp,
                   java.lang.String s)
Create a new SketchyText object that displays the given string on the given drawing panel.

Parameters:
dp - the DrawingPanel for the text
s - the string that will be displayed by this text object.
Method Detail

setFontSize

public void setFontSize(int size)
Change the size of the font of this text object to the specified value.

Parameters:
size - the new font size of this text object

getFontSize

public int getFontSize()
Get the size of the font of this text object.

Returns:
the size

setLocation

public void setLocation(java.awt.Point p)
Set the location of this text object. The center of the text object will be positioned at the specified point.

Parameters:
p - the point representing the new position of the center of this text object

getLocation

public java.awt.Point getLocation()
Get the location of the center of this text object.

Returns:
the Point that represents the position of the center of this text object

getDimension

public java.awt.Dimension getDimension()
Get the dimension of this text object.

Returns:
the Dimension object which describes the size of this text object