objectdraw
Class FramedRoundedRect

java.lang.Object
  extended byobjectdraw.Drawable
      extended byobjectdraw.Drawable2D
          extended byobjectdraw.Resizable2D
              extended byobjectdraw.Rectangular
                  extended byobjectdraw.RoundedRect
                      extended byobjectdraw.FramedRoundedRect
All Implemented Interfaces:
Drawable2DInterface, DrawableInterface, Resizable2DInterface, java.io.Serializable

public class FramedRoundedRect
extends objectdraw.RoundedRect
implements Resizable2DInterface

FramedRoundedRect is an implementation of a drawable framed rounded rectangle object.

Version:
1.1.2 released July 2006
See Also:
Serialized Form

Constructor Summary
FramedRoundedRect(double x, double y, double width, double height, double arcWidth, double arcHeight, DrawingCanvas canvas)
          Creates a new FramedRoundedRect object.
FramedRoundedRect(Location origin, double width, double height, double arcWidth, double arcHeight, DrawingCanvas canvas)
          Creates a new FramedRoundedRect object.
FramedRoundedRect(Location p0, Location p1, double arcWidth, double arcHeight, DrawingCanvas canvas)
          Creates a new FramedRoundedRect object.
 
Method Summary
 void addToCanvas(DrawingCanvas c)
          Places an existing object on a specified DrawingCanvas.
 boolean contains(Location point)
          Determines if a particular position on the DrawingCanvas is contained within the object.
 double getArcHeight()
          Gets the height of the arc that rounds off the corners.
 double getArcWidth()
          Gets the width of the arc that rounds off the corners.
 DrawingCanvas getCanvas()
          Determine which (if any) DrawingCanvas this object is positioned on
 java.awt.Color getColor()
          Retrieves the color of the object.
 double getHeight()
          Get the height of a graphical object
 Location getLocation()
          Get a graphical object's position
 double getWidth()
          Get the width of a graphical object
 double getX()
          Get the x coordinate of left edge of rectangle bounding the object
 double getY()
          Get the y coordinate of top edge of rectangle bounding the object
 void hide()
          Temporarily hides an object on a DrawingCanvas from view.
 boolean isHidden()
          Determine whether an object is currently visible on its canvas
 void move(double dx, double dy)
          Moves the object within the canvas in the x and y direction by the amounts specified as parameters.
 void moveTo(double x, double y)
          Moves the object within the canvas to the x and y coordinates provided.
 void moveTo(Location point)
          Moves the object within the canvas to the specified Location
 boolean overlaps(Drawable2DInterface item)
          Determines if another Drawable's bounding rectangle overlaps with this object's bounding rectangle.
 void removeFromCanvas()
          Permanently removes the object from the canvas it is currently on.
 void sendBackward()
          Sends the object backward.
 void sendForward()
          Sends the object forward.
 void sendToBack()
          Sends the object to the back.
 void sendToFront()
          Sends the object to the front.
 void setArcHeight(double arcHeight)
          Change the arc height for the rounded corners of a rounded rectangle
 void setArcWidth(double arcWidth)
          Change the width for the rounded corners of a rounded rectangle
 void setColor(java.awt.Color c)
          Sets the color of the object.
 void setHeight(double height)
          Sets the height of the object's bounding rectangle
 void setSize(double width, double height)
          Sets the width and height of the rectangle bounding the object.
 void setWidth(double width)
          Sets the width of the object's bounding rectangle
 void show()
          Shows the object if it has been hidden.
 java.lang.String toString()
          Generates a string representation of the object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface objectdraw.Resizable2DInterface
setHeight, setSize, setWidth
 
Methods inherited from interface objectdraw.Drawable2DInterface
getHeight, getLocation, getWidth, getX, getY, overlaps
 
Methods inherited from interface objectdraw.DrawableInterface
addToCanvas, contains, getCanvas, getColor, hide, isHidden, move, moveTo, moveTo, removeFromCanvas, sendBackward, sendForward, sendToBack, sendToFront, setColor, show
 

Constructor Detail

FramedRoundedRect

public FramedRoundedRect(Location origin,
                         double width,
                         double height,
                         double arcWidth,
                         double arcHeight,
                         DrawingCanvas canvas)
Creates a new FramedRoundedRect object.

Parameters:
origin - the upper left corner of the bounding rectangle.
width - the width of the bounding rectangle.
height - the height of the bounding rectangle.
arcWidth - the width of the corner arc.
arcHeight - the height of the corner arc.
canvas - the canvas in which the object is created.

FramedRoundedRect

public FramedRoundedRect(double x,
                         double y,
                         double width,
                         double height,
                         double arcWidth,
                         double arcHeight,
                         DrawingCanvas canvas)
Creates a new FramedRoundedRect object.

Parameters:
x - coordinate of the upper left corner of the bounding rectangle.
y - coordinate of the upper left corner of the bounding rectangle.
width - the width of the bounding rectangle.
height - the height of the bounding rectangle.
arcWidth - the width of the corner arc.
arcHeight - the height of the corner arc.
canvas - the canvas in which the object is created.

FramedRoundedRect

public FramedRoundedRect(Location p0,
                         Location p1,
                         double arcWidth,
                         double arcHeight,
                         DrawingCanvas canvas)
Creates a new FramedRoundedRect object.

Parameters:
p0 - the upper left corner of the bounding rectangle.
p1 - the other diagonal endpoint.
arcWidth - the width of the corner arc.
arcHeight - the height of the corner arc.
canvas - the canvas in which the object is created.
Method Detail

toString

public java.lang.String toString()
Generates a string representation of the object.

Returns:
a string representation of the object.

getArcWidth

public double getArcWidth()
Gets the width of the arc that rounds off the corners.

Returns:
arc width of the corner of this rect.

getArcHeight

public double getArcHeight()
Gets the height of the arc that rounds off the corners.

Returns:
arc height of the corner of this rect.

setArcWidth

public void setArcWidth(double arcWidth)
Change the width for the rounded corners of a rounded rectangle

Parameters:
arcWidth - angle width for this rect.

setArcHeight

public void setArcHeight(double arcHeight)
Change the arc height for the rounded corners of a rounded rectangle

Parameters:
arcHeight - angle height for this rect.

contains

public boolean contains(Location point)
Description copied from interface: DrawableInterface
Determines if a particular position on the DrawingCanvas is contained within the object.


setSize

public void setSize(double width,
                    double height)
Description copied from interface: Resizable2DInterface
Sets the width and height of the rectangle bounding the object.

Specified by:
setSize in interface Resizable2DInterface

setWidth

public void setWidth(double width)
Description copied from interface: Resizable2DInterface
Sets the width of the object's bounding rectangle

Specified by:
setWidth in interface Resizable2DInterface

setHeight

public void setHeight(double height)
Description copied from interface: Resizable2DInterface
Sets the height of the object's bounding rectangle

Specified by:
setHeight in interface Resizable2DInterface

getWidth

public double getWidth()
Description copied from interface: Drawable2DInterface
Get the width of a graphical object

Specified by:
getWidth in interface Drawable2DInterface

getHeight

public double getHeight()
Description copied from interface: Drawable2DInterface
Get the height of a graphical object

Specified by:
getHeight in interface Drawable2DInterface

moveTo

public void moveTo(Location point)
Description copied from interface: DrawableInterface
Moves the object within the canvas to the specified Location


move

public void move(double dx,
                 double dy)
Description copied from interface: DrawableInterface
Moves the object within the canvas in the x and y direction by the amounts specified as parameters.


getX

public double getX()
Description copied from interface: Drawable2DInterface
Get the x coordinate of left edge of rectangle bounding the object

Specified by:
getX in interface Drawable2DInterface
Returns:
the x coordinate of the upper left corner of the object's bounding rectangle

getY

public double getY()
Description copied from interface: Drawable2DInterface
Get the y coordinate of top edge of rectangle bounding the object

Specified by:
getY in interface Drawable2DInterface
Returns:
the y coordinate of the upper left corner of the object's bounding rectangle

getLocation

public Location getLocation()
Description copied from interface: Drawable2DInterface
Get a graphical object's position

Specified by:
getLocation in interface Drawable2DInterface
Returns:
the location of the upper left corner of the object's bounding rectangle

overlaps

public boolean overlaps(Drawable2DInterface item)
Description copied from interface: Drawable2DInterface
Determines if another Drawable's bounding rectangle overlaps with this object's bounding rectangle.

Specified by:
overlaps in interface Drawable2DInterface
Parameters:
item - the other object
Returns:
true if item intersects this object; false otherwise.

addToCanvas

public void addToCanvas(DrawingCanvas c)
Description copied from interface: DrawableInterface
Places an existing object on a specified DrawingCanvas. This method will fail if the object is already on a canvas. Therefore, to move an object from one canvas to another one must use removeFromCanvas() followed by addToCanvas. This method can also be invoked to place a Drawable object on a DrawingCanvas after the object is loaded from a file or other stream.

Specified by:
addToCanvas in interface DrawableInterface
Parameters:
c - the canvas on which the object should be drawn

removeFromCanvas

public void removeFromCanvas()
Description copied from interface: DrawableInterface
Permanently removes the object from the canvas it is currently on. If you want to just make an object temporarily invisible, use hide() instead.

Specified by:
removeFromCanvas in interface DrawableInterface

getCanvas

public DrawingCanvas getCanvas()
Description copied from interface: DrawableInterface
Determine which (if any) DrawingCanvas this object is positioned on

Specified by:
getCanvas in interface DrawableInterface
Returns:
the DrawingCanvas holding this object or null if it the object is not currently associated with any canvas

hide

public void hide()
Description copied from interface: DrawableInterface
Temporarily hides an object on a DrawingCanvas from view. This method should only be used if the object may later be made visible again using the show() method. If the goal is to remove an object from the display permanently, the removeFromCanvas() method should be used instead.

Specified by:
hide in interface DrawableInterface

show

public void show()
Description copied from interface: DrawableInterface
Shows the object if it has been hidden.

Specified by:
show in interface DrawableInterface

isHidden

public boolean isHidden()
Description copied from interface: DrawableInterface
Determine whether an object is currently visible on its canvas

Specified by:
isHidden in interface DrawableInterface
Returns:
true if the object is currently hidden.

moveTo

public void moveTo(double x,
                   double y)
Description copied from interface: DrawableInterface
Moves the object within the canvas to the x and y coordinates provided.

Specified by:
moveTo in interface DrawableInterface
Parameters:
x - horizontal coordinate of destination.
y - horizontal coordinate of destination.

setColor

public void setColor(java.awt.Color c)
Description copied from interface: DrawableInterface
Sets the color of the object.

Specified by:
setColor in interface DrawableInterface
Parameters:
c - the color.

getColor

public java.awt.Color getColor()
Description copied from interface: DrawableInterface
Retrieves the color of the object.

Specified by:
getColor in interface DrawableInterface
Returns:
the object's color.

sendForward

public void sendForward()
Description copied from interface: DrawableInterface
Sends the object forward.

Specified by:
sendForward in interface DrawableInterface

sendBackward

public void sendBackward()
Description copied from interface: DrawableInterface
Sends the object backward.

Specified by:
sendBackward in interface DrawableInterface

sendToFront

public void sendToFront()
Description copied from interface: DrawableInterface
Sends the object to the front.

Specified by:
sendToFront in interface DrawableInterface

sendToBack

public void sendToBack()
Description copied from interface: DrawableInterface
Sends the object to the back.

Specified by:
sendToBack in interface DrawableInterface