tapestry.support.swing
Class TRectangle

java.lang.Object
  |
  +--tapestry.support.swing.TAnimator
        |
        +--tapestry.support.swing.TDrawable
              |
              +--tapestry.support.swing.TRectangle

public class TRectangle
extends TDrawable

A class that is a rectangle defined by a center location (x, y) and dimension (w x h).

Coordinates for a rectangle are as you would expect from cartesian geometry. (0,0) represents the center of container in which the Rectangle is drawn, with x-coordinates increasing to the right and y-coordinates increasing to the top of the container. Coordinates are given in pixel units.


Fields inherited from class tapestry.support.swing.TAnimator
DEFAULT_DELAY
 
Constructor Summary
TRectangle(int cx, int cy, int size)
          Creates a new TRectangle centered at position (cx, cy) with specified size (i.e., a square).
TRectangle(int cx, int cy, int width, int height)
          Creates a new TRectangle centered at position (cx, cy) with specified width and height.
TRectangle(java.awt.Point center, java.awt.Dimension size)
          Creates a new TRectangle centered at specified point with specified size.
 
Method Summary
 void drawFeature(java.awt.Graphics g, boolean isFilled)
           
 java.awt.Dimension getSize()
          Returns the shape's size.
 void setSize(int width, int height)
          Sets the shape's size.
 
Methods inherited from class tapestry.support.swing.TDrawable
act, draw, fill, getCenter, getColor, hide, move, outline, setCenter, setCenter, setColor, setContainer, setLineWidth, show
 
Methods inherited from class tapestry.support.swing.TAnimator
actionPerformed, dispose, getContainer, getCount, getDelay, init, isRunning, setDelay, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TRectangle

public TRectangle(int cx,
                  int cy,
                  int size)
Creates a new TRectangle centered at position (cx, cy) with specified size (i.e., a square).
Parameters:
cx - center x coordinate of box
cy - center y coordinate of box
size - width and height of box

TRectangle

public TRectangle(int cx,
                  int cy,
                  int width,
                  int height)
Creates a new TRectangle centered at position (cx, cy) with specified width and height.
Parameters:
cx - center x coordinate of box
cy - center y coordinate of box
width - width of box
height - height of box

TRectangle

public TRectangle(java.awt.Point center,
                  java.awt.Dimension size)
Creates a new TRectangle centered at specified point with specified size.
Parameters:
center - center point of box
size - dimensions of box
Method Detail

getSize

public java.awt.Dimension getSize()
Returns the shape's size.
Returns:
width and height of shape
Overrides:
getSize in class TDrawable

setSize

public void setSize(int width,
                    int height)
Sets the shape's size.
Parameters:
width - new width of shape
height - new height of shape
Overrides:
setSize in class TDrawable

drawFeature

public void drawFeature(java.awt.Graphics g,
                        boolean isFilled)
Overrides:
drawFeature in class TDrawable