Class TextShape

public class TextShape
implements Shape

TextShape is used for displaying text onto the GWindow. Status: implementation not complete (need point size control and more testing).

Version:
$Id:$
Author:
Ben Dugan

Constructor Detail

TextShape

public TextShape(java.lang.String txt,
                 int x,
                 int y)
Create a new rectangle of the given size.
Parameters:
x - the x coordinate of the upper left corner
y - the y coordinate of the upper left corner
width - the width of the rectangle
height - the height of the rectangle
Method Detail

intersects

public boolean intersects(Rectangle r)
This shape intersects the given rectangle if at least one of the other rectangle's verteces is contained within the bounds of this rectangle.

paint

public void paint(java.awt.Graphics g)
Paint/draw this shape onto the given graphics context.
Specified by:
paint in interface Shape
Overrides:
paint in class ShapeImpl

move

public void move(int x,
                 int y)
Translate this shape by the given amount.
Specified by:
move in interface Shape
Overrides:
move in class ShapeImpl
Following copied from interface: Shape
Parameters:
deltaX - offset in the X direction.
deltaY - offset in the Y direction.

toString

public java.lang.String toString()
Description copied from class: ShapeImpl
Answer the printed representation of this shape.
Overrides:
toString in class ShapeImpl

setWindow

public void setWindow(GWindow gw)
Attach the shape to the given window.
Specified by:
setWindow in interface Shape

intersects

public boolean intersects(Shape s)
Does this shape intersect the other shape?
Specified by:
intersects in interface Shape

getBoundingBox

public Rectangle getBoundingBox()
Answer the Rectangle that bounds this shape.
Specified by:
getBoundingBox in interface Shape

getColor

public java.awt.Color getColor()
Answer the color of this shape.
Specified by:
getColor in interface Shape

setColor

public void setColor(java.awt.Color c)
Set the color of this shape.
Specified by:
setColor in interface Shape