tapestry.support.swing
Class TDrawable

java.lang.Object
  |
  +--tapestry.support.swing.TAnimator
        |
        +--tapestry.support.swing.TDrawable
Direct Known Subclasses:
TArc, TComposite, TImage, TLine, TOval, TRectangle, TText

public abstract class TDrawable
extends TAnimator

An abstract class that represents any shape that can be drawn. You cannot create a TDrawable directly, but can use it to refer to what is common among several shapes.


Fields inherited from class tapestry.support.swing.TAnimator
DEFAULT_DELAY
 
Constructor Summary
TDrawable(java.awt.Point center)
          Creates a drawable shape centered at point center contained in the applet's canvas.
TDrawable(java.awt.Point center, TCanvas canvas)
          Creates a drawable shape centered at point center contained in canvas.
 
Method Summary
 void act()
          By default, shapes do nothing.
 void draw(java.awt.Graphics g)
           
abstract  void drawFeature(java.awt.Graphics g, boolean isFilled)
           
 void fill()
          Display the shape as filled in when drawn.
 java.awt.Point getCenter()
          Returns the shape's center.
 java.awt.Color getColor()
          Get the color of the shape when drawn.
abstract  java.awt.Dimension getSize()
          Returns the shape's size.
 void hide()
           
 void move(int dx, int dy)
          Moves the shape's center point by specified amnount.
 void outline()
          Display the shape as outlined when drawn.
 void setCenter(int x, int y)
          Sets the shape's center to the given point.
 void setCenter(java.awt.Point p)
          Sets the shape's center to the given point.
 void setColor(java.awt.Color color)
          Display the shape in specified color when drawn.
 void setContainer(TCanvas canvas)
           
 void setLineWidth(double width)
           
abstract  void setSize(int width, int height)
          Sets the shape's size.
 void 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

TDrawable

public TDrawable(java.awt.Point center,
                 TCanvas canvas)
Creates a drawable shape centered at point center contained in canvas.
Parameters:
center - center point of drawable shape
canvas - container for drawable shape

TDrawable

public TDrawable(java.awt.Point center)
Creates a drawable shape centered at point center contained in the applet's canvas.
Parameters:
center - center point of drawable shape
Method Detail

act

public void act()
By default, shapes do nothing. Override this function to create a recurring behavior.
Overrides:
act in class TAnimator

getSize

public abstract java.awt.Dimension getSize()
Returns the shape's size.
Returns:
width and height of shape

setSize

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

getCenter

public java.awt.Point getCenter()
Returns the shape's center.
Returns:
center point of shape

setCenter

public void setCenter(java.awt.Point p)
Sets the shape's center to the given point.
Parameters:
center - new center point of shape

setCenter

public void setCenter(int x,
                      int y)
Sets the shape's center to the given point.
Parameters:
x - new x-coordinate of shape
y - new x-coordinate of shape

fill

public void fill()
Display the shape as filled in when drawn.

outline

public void outline()
Display the shape as outlined when drawn.

getColor

public java.awt.Color getColor()
Get the color of the shape when drawn.
Returns:
color color of shape

setColor

public void setColor(java.awt.Color color)
Display the shape in specified color when drawn.
Parameters:
color - new color of shape

setLineWidth

public void setLineWidth(double width)

move

public void move(int dx,
                 int dy)
Moves the shape's center point by specified amnount.
Parameters:
dx - distance to move horizontally
dy - distance to move vertically

show

public void show()

hide

public void hide()

draw

public void draw(java.awt.Graphics g)

drawFeature

public abstract void drawFeature(java.awt.Graphics g,
                                 boolean isFilled)

setContainer

public void setContainer(TCanvas canvas)