diva.canvas.toolbox
Class BasicRectangle

java.lang.Object
  extended by diva.canvas.AbstractFigure
      extended by diva.canvas.toolbox.BasicFigure
          extended by diva.canvas.toolbox.BasicRectangle
All Implemented Interfaces:
CanvasComponent, Figure, ShapedFigure, VisibleComponent, UserObjectContainer
Direct Known Subclasses:
BasicGrabHandle, ConnectorTutorial.SitedRectangle, MoveHandle

public class BasicRectangle
extends BasicFigure

A figure that displays as a rectangle. This is a convenience class for creating rectangles. It inherits from BasicFigure, and so contains a single Rectangle2D as its shape. It provides a useful set of constructors.

Version:
$Id: BasicRectangle.java 38798 2005-07-08 20:00:01Z cxh $
Author:
John Reekie

Constructor Summary
BasicRectangle(double x, double y, double width, double height)
          Create a new rectangle with the given origin and size, a unit-width continuous stroke and no paint pattern.
BasicRectangle(double x, double y, double width, double height, float lineWidth)
          Create a new rectangle with the given origin, size, and outline width.
BasicRectangle(double x, double y, double width, double height, java.awt.Paint fill)
          Create a new rectangle with the given origin, size, and fill paint.
BasicRectangle(double x, double y, double width, double height, java.awt.Paint fill, float lineWidth)
          Create a new rectangle with the given origin, size, fill, and outline width.
BasicRectangle(java.awt.geom.Rectangle2D rect)
          Create a new rectangle with the given rectangle shape, a unit-width continuous stroke and no paint pattern.
BasicRectangle(java.awt.geom.Rectangle2D bounds, java.awt.Paint fill)
          Create a new rectangle with the given bounds and fill paint.
 
Method Summary
 void translate(double x, double y)
          Translate the rectangle the given distance
 
Methods inherited from class diva.canvas.toolbox.BasicFigure
getBounds, getComposite, getDashArray, getFillPaint, getLineWidth, getOrigin, getShape, getStrokePaint, hit, isCentered, paint, setCentered, setComposite, setDashArray, setFillPaint, setLineWidth, setPrototypeShape, setShape, setStroke, setStrokePaint, transform
 
Methods inherited from class diva.canvas.AbstractFigure
contains, getInteractor, getLayer, getParent, getToolTipText, getTransformContext, getUserObject, intersects, isVisible, paint, repaint, repaint, setInteractor, setParent, setToolTipText, setUserObject, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface diva.canvas.Figure
contains, getInteractor, getLayer, getParent, getToolTipText, intersects, setInteractor, setParent, setToolTipText
 
Methods inherited from interface diva.canvas.VisibleComponent
isVisible, paint, setVisible
 
Methods inherited from interface diva.canvas.CanvasComponent
getTransformContext, repaint, repaint
 
Methods inherited from interface diva.util.UserObjectContainer
getUserObject, setUserObject
 

Constructor Detail

BasicRectangle

public BasicRectangle(java.awt.geom.Rectangle2D rect)
Create a new rectangle with the given rectangle shape, a unit-width continuous stroke and no paint pattern.


BasicRectangle

public BasicRectangle(double x,
                      double y,
                      double width,
                      double height)
Create a new rectangle with the given origin and size, a unit-width continuous stroke and no paint pattern.


BasicRectangle

public BasicRectangle(double x,
                      double y,
                      double width,
                      double height,
                      java.awt.Paint fill)
Create a new rectangle with the given origin, size, and fill paint. It has no outline.


BasicRectangle

public BasicRectangle(java.awt.geom.Rectangle2D bounds,
                      java.awt.Paint fill)
Create a new rectangle with the given bounds and fill paint. It has no outline.


BasicRectangle

public BasicRectangle(double x,
                      double y,
                      double width,
                      double height,
                      float lineWidth)
Create a new rectangle with the given origin, size, and outline width. It has no fill.


BasicRectangle

public BasicRectangle(double x,
                      double y,
                      double width,
                      double height,
                      java.awt.Paint fill,
                      float lineWidth)
Create a new rectangle with the given origin, size, fill, and outline width.

Method Detail

translate

public void translate(double x,
                      double y)
Translate the rectangle the given distance

Specified by:
translate in interface Figure
Overrides:
translate in class AbstractFigure