acm.graphics
Class GRoundRect

java.lang.Object
  extended by acm.graphics.GObject
      extended by acm.graphics.GRect
          extended by acm.graphics.GRoundRect

public class GRoundRect
extends GRect

The GRoundRect class is a graphical object whose appearance consists of a rounded rectangle.


Field Summary
double DEFAULT_ARC
The default arc diameter used for the corners of a rounded rectangle.
 
Constructor Summary
GRoundRect(double width, double height)
Constructs a new rounded rectangle with the specified width and height, positioned at the origin.
GRoundRect(double x, double y, double width, double height)
Constructs a new rounded rectangle with the specified bounds.
GRoundRect(double x, double y, double width, double height, double arcSize)
Constructs a new rounded rectangle with the specified bounds and a single parameter describing both the describing the curvature at the corners.
GRoundRect(double x, double y, double width, double height, double arcWidth, double arcHeight)
Constructs a new rounded rectangle with the specified bounds and arc parameters describing the curvature at the corners.
 
Method Summary
 double getArcHeight()
Returns the y component of the corner radius.
 double getArcWidth()
Returns the x component of the corner radius.
 
Inherited Method Summary
voidaddMouseListener(MouseListener listener)
Adds a mouse listener to this graphical object.
voidaddMouseMotionListener(MouseMotionListener listener)
Adds a mouse motion listener to this graphical object.
booleancontains(GPoint pt)
Checks to see whether a point is inside the object.
booleancontains(double x, double y)
Checks to see whether a point is inside the object.
GRectanglegetBounds()
Returns the bounding box for this object.
ColorgetColor()
Returns the color used to display this object.
ColorgetFillColor()
Returns the color used to display the filled region of this object.
doublegetHeight()
Returns the height of this object, which is defined to be the height of the bounding box.
GPointgetLocation()
Returns the location of this object as a GPoint.
GDimensiongetSize()
Returns the size of the bounding box for this object.
doublegetWidth()
Returns the width of this object, which is defined to be the width of the bounding box.
doublegetX()
Returns the x-coordinate of the object.
doublegetY()
Returns the y-coordinate of the object.
booleanisFilled()
Returns whether this object is filled.
booleanisVisible()
Checks to see whether this object is visible.
voidmove(double dx, double dy)
Moves the object on the screen using the displacements dx and dy.
voidmovePolar(double r, double theta)
Moves the object using displacements given in polar coordinates.
voidremoveMouseListener(MouseListener listener)
Removes a mouse listener from this graphical object.
voidremoveMouseMotionListener(MouseMotionListener listener)
Removes a mouse motion listener from this graphical object.
voidscale(double sf)
Scales the object on the screen by the scale factor sf, which applies in both dimensions.
voidscale(double sx, double sy)
Scales the object on the screen by the scale factors sx and sy.
voidsendBackward()
Moves this object one step toward the back in the z dimension.
voidsendForward()
Moves this object one step toward the front in the z dimension.
voidsendToBack()
Moves this object to the back of the display in the z dimension.
voidsendToFront()
Moves this object to the front of the display in the z dimension.
voidsetBounds(GRectangle bounds)
Changes the bounds of this object as specified.
voidsetBounds(double x, double y, double width, double height)
Changes the bounds of this object to the specified parameters.
voidsetColor(Color color)
Sets the color used to display this object.
voidsetFillColor(Color color)
Sets the color used to display the filled region of this object.
voidsetFilled(boolean fill)
Sets whether this object is filled.
voidsetLocation(GPoint pt)
Sets the location of this object to the specified point.
voidsetLocation(double x, double y)
Sets the location of this object to the point (x, y).
voidsetSize(double width, double height)
Changes the size of this object to the specified width and height.
voidsetVisible(boolean visible)
Sets whether this object is visible.
 

Field Detail

public static final double DEFAULT_ARC

The default arc diameter used for the corners of a rounded rectangle.

See Also:
Constant Field Values
Constructor Detail

public GRoundRect(double width, double height)

Constructs a new rounded rectangle with the specified width and height, positioned at the origin.

 
Usage: GRoundRect rr = new GRoundRect(width, height); 
Parameters: 
width  The width of the rectangle in pixels
height  The height of the rectangle in pixels
 


public GRoundRect(double x, double y, double width, double height)

Constructs a new rounded rectangle with the specified bounds.

 
Usage: GRoundRect rr = new GRoundRect(x, y, width, height); 
Parameters: 
 The x-coordinate of the upper left corner
 The y-coordinate of the upper left corner
width  The width of the rectangle in pixels
height  The height of the rectangle in pixels
 


public GRoundRect(double x, double y, double width, double height, double arcSize)

Constructs a new rounded rectangle with the specified bounds and a single parameter describing both the describing the curvature at the corners.

 
Usage: GRoundRect rr = new GRoundRect(x, y, width, height, arcSize); 
Parameters: 
 The x-coordinate of the upper left corner
 The y-coordinate of the upper left corner
width  The width of the rectangle in pixels
height  The height of the rectangle in pixels
arcSize  The diameter of the circle in place at each corner
 


public GRoundRect(double x, double y, double width, double height, double arcWidth, double arcHeight)

Constructs a new rounded rectangle with the specified bounds and arc parameters describing the curvature at the corners.

 
Usage: GRoundRect rr = new GRoundRect(x, y, width, height, arcWidth, arcHeight); 
Parameters: 
 The x-coordinate of the upper left corner
 The y-coordinate of the upper left corner
width  The width of the rectangle in pixels
height  The height of the rectangle in pixels
arcWidth  The width of the oval in place at each corner
arcHeight  The height of the oval in place at each corner
 

Method Detail

public double getArcHeight()

Returns the y component of the corner radius.

 
Usage: double arcHeight = rr.getArcHeight(); 
Returns: The y component of the corner radius, in pixels.
 


public double getArcWidth()

Returns the x component of the corner radius.

 
Usage: double arcWidth = rr.getArcWidth(); 
Returns: The x component of the corner radius, in pixels.