wheelsunh.users
Class RectangularShape

java.lang.Object
  extended by wheelsunh.etc.AbstractGraphic
      extended by wheelsunh.users.AbstractShape
          extended by wheelsunh.users.Shape
              extended by wheelsunh.users.RectangularShape
All Implemented Interfaces:
AdvancedColorable, Colorable, CustomGraphic, Locatable, Rotatable, Sizeable
Direct Known Subclasses:
Ellipse, Rectangle, RoundedRectangle

public abstract class RectangularShape
extends Shape
implements Sizeable, AdvancedColorable

Superclass for all Shapes that can be described in terms of rectangular dimensions (ellipse, rectangle, etc.).


Field Summary
 
Fields inherited from class wheelsunh.users.Shape
_c, _dp, _shape, DEFAULT_COLOR
 
Fields inherited from class wheelsunh.users.AbstractShape
_rot
 
Constructor Summary
RectangularShape(java.awt.geom.RectangularShape s)
          The default constructor will draw the shape in the center of the wheelsunh.users.Frame's DrawingPanel, with dimension DEFAULT_WIDTH x DEFAULT_HEIGHT and color DEFAULT_COLOR.
RectangularShape(java.awt.geom.RectangularShape s, java.awt.Color c)
          Draws new shape in the wheelsunh.users.Frame's DrawingPanel with default dimensions and location, and color set to the passed-in color.
RectangularShape(java.awt.geom.RectangularShape s, DrawingPanel dp)
          Constructs a rectagular shape with the passed-in properties.
RectangularShape(java.awt.geom.RectangularShape s, int degrees)
          Draws new shape with default location, color, and dimension in the wheelsunh.users.DrawingPanel, at a rotation of degrees.
RectangularShape(java.awt.geom.RectangularShape s, int x, int y)
          Draws new shape in the wheelsunh.users.Frame's DrawingPanel with default color and location, and location set to the passed-in values.
 
Method Summary
 void actualPaint(java.awt.Graphics2D g)
          Overrides actualPaint to paint a frame and fill with the specified colors.
 java.awt.Rectangle getBounds()
          Overrides the getBounds method of Shape to account for the shape's frame.
 java.awt.Color getFillColor()
          Returns the shape's fill color.
 java.awt.Color getFrameColor()
          Returns the color of the shape's frame.
 int getFrameThickness()
          Returns the thickness of the frame's stroke.
 int getHeight()
          Returns the shape's height.
 java.awt.Point getLocation()
          Returns the shape's location.
 java.awt.Dimension getSize()
          Returns the shape's dimensions.
 int getWidth()
          Returns the shape's width.
 int getXLocation()
          Returns the x value of the shape's location.
 int getYLocation()
          Returns the y value of the shape's location.
 void setColor(java.awt.Color c)
          Overridden to set the color of the shape's frame and fill.
 void setFillColor(java.awt.Color c)
          Sets the color of the shape's fill.
 void setFrameColor(java.awt.Color c)
          Sets the color of the shape's frame.
 void setFrameThickness(int thickness)
          Sets the thickness of the frame's stroke.
 void setLocation(int x, int y)
          Set the location of the upper-left corner of the shape's bounding box.
 void setLocation(java.awt.Point p)
          Set the location of the upper-left corner of the shape's bounding box.
 void setSize(java.awt.Dimension d)
          Set the dimension of the shape.
 void setSize(int width, int height)
          Set the dimension of the shape.
 
Methods inherited from class wheelsunh.users.Shape
contains, getColor, getRotation, hide, paint, setRotation, show
 
Methods inherited from class wheelsunh.users.AbstractShape
boundsIntersects, center, distance, getCenter, getCenterX, getCenterY, getIntersection, intersects, intersects, setCenter
 
Methods inherited from class wheelsunh.etc.AbstractGraphic
mouseClicked, mouseDragged, mousePressed, mouseReleased
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface wheelsunh.Colorable
getColor
 

Constructor Detail

RectangularShape

public RectangularShape(java.awt.geom.RectangularShape s)
The default constructor will draw the shape in the center of the wheelsunh.users.Frame's DrawingPanel, with dimension DEFAULT_WIDTH x DEFAULT_HEIGHT and color DEFAULT_COLOR.


RectangularShape

public RectangularShape(java.awt.geom.RectangularShape s,
                        java.awt.Color c)
Draws new shape in the wheelsunh.users.Frame's DrawingPanel with default dimensions and location, and color set to the passed-in color.


RectangularShape

public RectangularShape(java.awt.geom.RectangularShape s,
                        int x,
                        int y)
Draws new shape in the wheelsunh.users.Frame's DrawingPanel with default color and location, and location set to the passed-in values.


RectangularShape

public RectangularShape(java.awt.geom.RectangularShape s,
                        int degrees)
Draws new shape with default location, color, and dimension in the wheelsunh.users.DrawingPanel, at a rotation of degrees.


RectangularShape

public RectangularShape(java.awt.geom.RectangularShape s,
                        DrawingPanel dp)
Constructs a rectagular shape with the passed-in properties. In this constructor, size is set to 0x0, location to (0, 0), and color to the same color as the DrawingPanel.

Method Detail

actualPaint

public void actualPaint(java.awt.Graphics2D g)
Overrides actualPaint to paint a frame and fill with the specified colors. If either color ahs been set to null, that part is not drawn.

Specified by:
actualPaint in class Shape
Parameters:
g - the instance of java.awt.Graphics2D that should be used to paint the shape

setColor

public void setColor(java.awt.Color c)
Overridden to set the color of the shape's frame and fill.

Specified by:
setColor in interface Colorable
Overrides:
setColor in class Shape

setFrameColor

public void setFrameColor(java.awt.Color c)
Sets the color of the shape's frame. If c is null, won't draw the frame.

Specified by:
setFrameColor in interface AdvancedColorable

getFrameColor

public java.awt.Color getFrameColor()
Returns the color of the shape's frame.

Specified by:
getFrameColor in interface AdvancedColorable

setFillColor

public void setFillColor(java.awt.Color c)
Sets the color of the shape's fill. If c is null, fill is not drawn (transparent).

Specified by:
setFillColor in interface AdvancedColorable

getFillColor

public java.awt.Color getFillColor()
Returns the shape's fill color.

Specified by:
getFillColor in interface AdvancedColorable

setFrameThickness

public void setFrameThickness(int thickness)
Sets the thickness of the frame's stroke. Must be positive. Ignores calls with negative arguments.


getFrameThickness

public int getFrameThickness()
Returns the thickness of the frame's stroke.


setLocation

public void setLocation(int x,
                        int y)
Set the location of the upper-left corner of the shape's bounding box.

Specified by:
setLocation in interface Locatable
Specified by:
setLocation in class Shape

setLocation

public void setLocation(java.awt.Point p)
Set the location of the upper-left corner of the shape's bounding box.

Specified by:
setLocation in interface Locatable
Specified by:
setLocation in class Shape

getLocation

public java.awt.Point getLocation()
Returns the shape's location.

Specified by:
getLocation in interface Locatable
Specified by:
getLocation in class Shape

getXLocation

public int getXLocation()
Returns the x value of the shape's location.

Specified by:
getXLocation in interface Locatable
Specified by:
getXLocation in class Shape

getYLocation

public int getYLocation()
Returns the y value of the shape's location.

Specified by:
getYLocation in interface Locatable
Specified by:
getYLocation in class Shape

setSize

public void setSize(int width,
                    int height)
Set the dimension of the shape.

Specified by:
setSize in interface Sizeable

setSize

public void setSize(java.awt.Dimension d)
Set the dimension of the shape.

Specified by:
setSize in interface Sizeable

getSize

public java.awt.Dimension getSize()
Returns the shape's dimensions.

Specified by:
getSize in interface Sizeable

getWidth

public int getWidth()
Returns the shape's width.

Specified by:
getWidth in interface Sizeable
Specified by:
getWidth in class AbstractShape

getHeight

public int getHeight()
Returns the shape's height.

Specified by:
getHeight in interface Sizeable
Specified by:
getHeight in class AbstractShape

getBounds

public java.awt.Rectangle getBounds()
Overrides the getBounds method of Shape to account for the shape's frame.

Overrides:
getBounds in class Shape