org.jscience.awt.util
Class DrawnRectangle

java.lang.Object
  extended by java.awt.geom.RectangularShape
      extended by java.awt.geom.Rectangle2D
          extended by java.awt.Rectangle
              extended by org.jscience.awt.util.DrawnRectangle
All Implemented Interfaces:
java.awt.Shape, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
EtchedRectangle

public class DrawnRectangle
extends java.awt.Rectangle

A Rectangle which draws itself inside of a Component.

DrawnRectangles may have their thickness and line color set, and are capable of reporting their inner getBounds (the area inside the lines).

Default thickness is 2.

If not set explicitly, the line color used is three shades darker than the background color of the Component being drawn into.

DrawnRectangles may be clear()ed, which clears both the exterior (the lines) and the interior (the area inside of the lines) of the DrawnRectangle.

DrawnRectangles may also be fill()ed with a specified color by calling fill(Color), or by calling setFillColor(Color) followed by fill().

By default, the fill Color is the background color of the Component drawn into.

See Also:
ThreeDRectangle, EtchedRectangle, Border, EtchedBorder, ThreeDBorder, gjt.test.DrawnRectangleTest, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D
java.awt.geom.Rectangle2D.Double, java.awt.geom.Rectangle2D.Float
 
Field Summary
protected static int _defaultThickness
           
protected  java.awt.Component drawInto
           
 
Fields inherited from class java.awt.Rectangle
height, width, x, y
 
Fields inherited from class java.awt.geom.Rectangle2D
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
 
Constructor Summary
DrawnRectangle(java.awt.Component drawInto)
           
DrawnRectangle(java.awt.Component drawInto, int thick)
           
DrawnRectangle(java.awt.Component drawInto, int x, int y, int w, int h)
           
DrawnRectangle(java.awt.Component drawInto, int thick, int x, int y, int w, int h)
           
 
Method Summary
protected  java.awt.Color brighter()
           
 void clear()
           
 void clearExterior()
           
 void clearInterior()
           
 java.awt.Component component()
           
 void fill()
           
 void fill(java.awt.Color color)
           
 java.awt.Color getFillColor()
           
 java.awt.Rectangle getInnerBounds()
           
 java.awt.Color getLineColor()
           
 int getThickness()
           
 void paint()
           
 java.lang.String paramString()
           
 void setFillColor(java.awt.Color fillColor)
           
 void setLineColor(java.awt.Color lineColor)
           
 void setThickness(int thick)
           
 java.lang.String toString()
           
 
Methods inherited from class java.awt.Rectangle
add, add, add, contains, contains, contains, contains, createIntersection, createUnion, equals, getBounds, getBounds2D, getHeight, getLocation, getSize, getWidth, getX, getY, grow, inside, intersection, intersects, isEmpty, move, outcode, reshape, resize, setBounds, setBounds, setLocation, setLocation, setRect, setSize, setSize, translate, union
 
Methods inherited from class java.awt.geom.Rectangle2D
add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, union
 
Methods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.Shape
contains, contains, contains, contains, getPathIterator, getPathIterator, intersects, intersects
 

Field Detail

_defaultThickness

protected static int _defaultThickness

drawInto

protected java.awt.Component drawInto
Constructor Detail

DrawnRectangle

public DrawnRectangle(java.awt.Component drawInto)

DrawnRectangle

public DrawnRectangle(java.awt.Component drawInto,
                      int thick)

DrawnRectangle

public DrawnRectangle(java.awt.Component drawInto,
                      int x,
                      int y,
                      int w,
                      int h)

DrawnRectangle

public DrawnRectangle(java.awt.Component drawInto,
                      int thick,
                      int x,
                      int y,
                      int w,
                      int h)
Method Detail

component

public java.awt.Component component()

getThickness

public int getThickness()

setThickness

public void setThickness(int thick)

setLineColor

public void setLineColor(java.awt.Color lineColor)

setFillColor

public void setFillColor(java.awt.Color fillColor)

fill

public void fill()

getLineColor

public java.awt.Color getLineColor()

getFillColor

public java.awt.Color getFillColor()

getInnerBounds

public java.awt.Rectangle getInnerBounds()

paint

public void paint()

clearInterior

public void clearInterior()

clearExterior

public void clearExterior()

clear

public void clear()

fill

public void fill(java.awt.Color color)

toString

public java.lang.String toString()
Overrides:
toString in class java.awt.Rectangle

paramString

public java.lang.String paramString()

brighter

protected java.awt.Color brighter()