This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


java.awt.geom
class RectangularShape

java.lang.Object extended by java.awt.geom.RectangularShape
All Implemented Interfaces:
Shape, Cloneable
Direct Known Subclasses:
Arc2D, Ellipse2D, Rectangle2D, RoundRectangle2D

public abstract class RectangularShape
extends Object
implements Shape, Cloneable

RectangularShape is the base class for a number of {@link Shape} objects whose geometry is defined by a rectangular frame. This class does not directly specify any specific geometry by itself, but merely provides manipulation methods inherited by a whole category of Shape objects. The manipulation methods provided by this class can be used to query and modify the rectangular frame, which provides a reference for the subclasses to define their geometry.


Constructor Summary
protected

          This is an abstract class that cannot be instantiated directly.
 
Method Summary
 Object

          Creates a new object of the same class and with the same contents as this object.
 boolean

          
 boolean

          
 Rectangle

          
 double

          Returns the X coordinate of the center of the framing rectangle of the Shape in double precision.
 double

          Returns the Y coordinate of the center of the framing rectangle of the Shape in double precision.
 Rectangle2D

          Returns the framing java.awt.geom.Rectangle2D that defines the overall shape of this object.
abstract double

          Returns the height of the framing rectangle in double precision.
 double

          Returns the largest X coordinate of the framing rectangle of the Shape in double precision.
 double

          Returns the largest Y coordinate of the framing rectangle of the Shape in double precision.
 double

          Returns the smallest X coordinate of the framing rectangle of the Shape in double precision.
 double

          Returns the smallest Y coordinate of the framing rectangle of the Shape in double precision.
 PathIterator
getPathIterator(AffineTransform at, double flatness)

          Returns an iterator object that iterates along the Shape object's boundary and provides access to a flattened view of the outline of the Shape object's geometry.
abstract double

          Returns the width of the framing rectangle in double precision.
abstract double

          Returns the X coordinate of the upper-left corner of the framing rectangle in double precision.
abstract double

          Returns the Y coordinate of the upper-left corner of the framing rectangle in double precision.
 boolean

          
abstract boolean

          Determines whether the RectangularShape is empty.
abstract void
setFrame(double x, double y, double w, double h)

          Sets the location and size of the framing rectangle of this Shape to the specified rectangular values.
 void

          Sets the location and size of the framing rectangle of this Shape to the specified java.awt.geom.Point2D and java.awt.geom.Dimension2D, respectively.
 void

          Sets the framing rectangle of this Shape to be the specified Rectangle2D.
 void
setFrameFromCenter(double centerX, double centerY, double cornerX, double cornerY)

          Sets the framing rectangle of this Shape based on the specified center point coordinates and corner point coordinates.
 void

          Sets the framing rectangle of this Shape based on a specified center Point2D and corner Point2D.
 void
setFrameFromDiagonal(double x1, double y1, double x2, double y2)

          Sets the diagonal of the framing rectangle of this Shape based on the two specified coordinates.
 void

          Sets the diagonal of the framing rectangle of this Shape based on two specified Point2D objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RectangularShape

protected RectangularShape()
This is an abstract class that cannot be instantiated directly.

Method Detail

clone

public Object clone()
Creates a new object of the same class and with the same contents as this object.

Overrides:
clone in class Object
Returns:
a clone of this instance.

contains

public boolean contains(Point2D p)
{@inheritDoc}

Parameters:
p

contains

public boolean contains(Rectangle2D r)
{@inheritDoc}

Parameters:
r

getBounds

public Rectangle getBounds()
{@inheritDoc}


getCenterX

public double getCenterX()
Returns the X coordinate of the center of the framing rectangle of the Shape in double precision.

Returns:
the X coordinate of the center of the framing rectangle of the Shape.

getCenterY

public double getCenterY()
Returns the Y coordinate of the center of the framing rectangle of the Shape in double precision.

Returns:
the Y coordinate of the center of the framing rectangle of the Shape.

getFrame

public Rectangle2D getFrame()
Returns the framing {@link Rectangle2D} that defines the overall shape of this object.

Returns:
a Rectangle2D, specified in double coordinates.

getHeight

public abstract double getHeight()
Returns the height of the framing rectangle in double precision.

Returns:
the height of the framing rectangle.

getMaxX

public double getMaxX()
Returns the largest X coordinate of the framing rectangle of the Shape in double precision.

Returns:
the largest X coordinate of the framing rectangle of the Shape.

getMaxY

public double getMaxY()
Returns the largest Y coordinate of the framing rectangle of the Shape in double precision.

Returns:
the largest Y coordinate of the framing rectangle of the Shape.

getMinX

public double getMinX()
Returns the smallest X coordinate of the framing rectangle of the Shape in double precision.

Returns:
the smallest X coordinate of the framing rectangle of the Shape.

getMinY

public double getMinY()
Returns the smallest Y coordinate of the framing rectangle of the Shape in double precision.

Returns:
the smallest Y coordinate of the framing rectangle of the Shape.

getPathIterator

public PathIterator getPathIterator(AffineTransform at,
                                    double flatness)
Returns an iterator object that iterates along the Shape object's boundary and provides access to a flattened view of the outline of the Shape object's geometry.

Only SEG_MOVETO, SEG_LINETO, and SEG_CLOSE point types will be returned by the iterator.

The amount of subdivision of the curved segments is controlled by the flatness parameter, which specifies the maximum distance that any point on the unflattened transformed curve can deviate from the returned flattened path segments. An optional {@link AffineTransform} can be specified so that the coordinates returned in the iteration are transformed accordingly.

Parameters:
at - an optional AffineTransform to be applied to the coordinates as they are returned in the iteration, or null if untransformed coordinates are desired.
flatness - the maximum distance that the line segments used to approximate the curved segments are allowed to deviate from any point on the original curve
Returns:
a PathIterator object that provides access to the Shape object's flattened geometry.

getWidth

public abstract double getWidth()
Returns the width of the framing rectangle in double precision.

Returns:
the width of the framing rectangle.

getX

public abstract double getX()
Returns the X coordinate of the upper-left corner of the framing rectangle in double precision.

Returns:
the X coordinate of the upper-left corner of the framing rectangle.

getY

public abstract double getY()
Returns the Y coordinate of the upper-left corner of the framing rectangle in double precision.

Returns:
the Y coordinate of the upper-left corner of the framing rectangle.

intersects

public boolean intersects(Rectangle2D r)
{@inheritDoc}

Parameters:
r

isEmpty

public abstract boolean isEmpty()
Determines whether the RectangularShape is empty. When the RectangularShape is empty, it encloses no area.

Returns:
true if the RectangularShape is empty; false otherwise.

setFrame

public abstract void setFrame(double x,
                              double y,
                              double w,
                              double h)
Sets the location and size of the framing rectangle of this Shape to the specified rectangular values.

Parameters:
x - the X coordinate of the upper-left corner of the specified rectangular shape
y - the Y coordinate of the upper-left corner of the specified rectangular shape
w - the width of the specified rectangular shape
h - the height of the specified rectangular shape

setFrame

public void setFrame(Point2D loc,
                     Dimension2D size)
Sets the location and size of the framing rectangle of this Shape to the specified {@link Point2D} and {@link Dimension2D}, respectively. The framing rectangle is used by the subclasses of RectangularShape to define their geometry.

Parameters:
loc - the specified Point2D
size - the specified Dimension2D

setFrame

public void setFrame(Rectangle2D r)
Sets the framing rectangle of this Shape to be the specified Rectangle2D. The framing rectangle is used by the subclasses of RectangularShape to define their geometry.

Parameters:
r - the specified Rectangle2D

setFrameFromCenter

public void setFrameFromCenter(double centerX,
                               double centerY,
                               double cornerX,
                               double cornerY)
Sets the framing rectangle of this Shape based on the specified center point coordinates and corner point coordinates. The framing rectangle is used by the subclasses of RectangularShape to define their geometry.

Parameters:
centerX - the X coordinate of the specified center point
centerY - the Y coordinate of the specified center point
cornerX - the X coordinate of the specified corner point
cornerY - the Y coordinate of the specified corner point

setFrameFromCenter

public void setFrameFromCenter(Point2D center,
                               Point2D corner)
Sets the framing rectangle of this Shape based on a specified center Point2D and corner Point2D. The framing rectangle is used by the subclasses of RectangularShape to define their geometry.

Parameters:
center - the specified center Point2D
corner - the specified corner Point2D

setFrameFromDiagonal

public void setFrameFromDiagonal(double x1,
                                 double y1,
                                 double x2,
                                 double y2)
Sets the diagonal of the framing rectangle of this Shape based on the two specified coordinates. The framing rectangle is used by the subclasses of RectangularShape to define their geometry.

Parameters:
x1 - the X coordinate of the start point of the specified diagonal
y1 - the Y coordinate of the start point of the specified diagonal
x2 - the X coordinate of the end point of the specified diagonal
y2 - the Y coordinate of the end point of the specified diagonal

setFrameFromDiagonal

public void setFrameFromDiagonal(Point2D p1,
                                 Point2D p2)
Sets the diagonal of the framing rectangle of this Shape based on two specified Point2D objects. The framing rectangle is used by the subclasses of RectangularShape to define their geometry.

Parameters:
p1 - the start Point2D of the specified diagonal
p2 - the end Point2D of the specified diagonal


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.