|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.geom.RectangularShape
java.awt.geom.Rectangle2D
java.awt.Rectangle
view.MyRectangle
public class MyRectangle
A Rectangle that allows construction with a string of the format
Supports all constructors from the super class plus a constructor with a single string., ; x
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D |
|---|
Rectangle2D.Double, Rectangle2D.Float |
| Field Summary |
|---|
| 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 | |
|---|---|
MyRectangle()
Constructs a new Rectangle whose top-left corner
is at (0, 0) in the coordinate space, and whose width and
height are both zero. |
|
MyRectangle(Dimension d)
Constructs a new Rectangle whose top left corner is
(0, 0) and whose width and height are specified
by the Dimension argument. |
|
MyRectangle(int width,
int height)
Constructs a new Rectangle whose top-left corner
is at (0, 0) in the coordinate space, and whose width and
height are specified by the arguments of the same name. |
|
MyRectangle(int x,
int y,
int width,
int height)
Constructs a new Rectangle whose top-left corner is
specified as
(x, y) and whose width and height
are specified by the arguments of the same name. |
|
MyRectangle(Point p)
Constructs a new Rectangle whose top-left corner is the
specified Point, and whose width and height are both zero. |
|
MyRectangle(Point p,
Dimension d)
Constructs a new Rectangle whose top-left corner is
specified by the Point argument, and
whose width and height are specified by the
Dimension argument. |
|
MyRectangle(Rectangle r)
Constructs a new Rectangle, initialized to match
the values of the specified Rectangle. |
|
MyRectangle(String desc)
Constrcuts a new rectangle from a string like '300,200;20x40'. |
|
| Method Summary | |
|---|---|
double |
distanceToEdge(Point2D inside)
Returns the distance of this pixel to the closest edge. |
static double |
distanceToEdge(Rectangle2D rec,
Point2D inside)
Returns the distance of this pixel to the closest edge. |
static Rectangle |
parseRectangle(String desc)
Parses a point from a String. |
String |
toString()
Overrides the string representation. |
static String |
toString(Rectangle p)
Overrides the string representation. |
| 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 |
| Constructor Detail |
|---|
public MyRectangle()
Rectangle whose top-left corner
is at (0, 0) in the coordinate space, and whose width and
height are both zero.
public MyRectangle(Rectangle r)
Rectangle, initialized to match
the values of the specified Rectangle.
r - the Rectangle from which to copy initial values
to a newly constructed Rectangle
public MyRectangle(int x,
int y,
int width,
int height)
Rectangle whose top-left corner is
specified as
(x, y) and whose width and height
are specified by the arguments of the same name.
x - the specified x coordinatey - the specified y coordinatewidth - the width of the Rectangleheight - the height of the Rectangle
public MyRectangle(int width,
int height)
Rectangle whose top-left corner
is at (0, 0) in the coordinate space, and whose width and
height are specified by the arguments of the same name.
width - the width of the Rectangleheight - the height of the Rectangle
public MyRectangle(Point p,
Dimension d)
Rectangle whose top-left corner is
specified by the Point argument, and
whose width and height are specified by the
Dimension argument.
p - a Point that is the top-left corner of
the Rectangled - a Dimension, representing the
width and height of the Rectanglepublic MyRectangle(Point p)
Rectangle whose top-left corner is the
specified Point, and whose width and height are both zero.
p - a Point that is the top left corner
of the Rectanglepublic MyRectangle(Dimension d)
Rectangle whose top left corner is
(0, 0) and whose width and height are specified
by the Dimension argument.
d - a Dimension, specifying width and heightpublic MyRectangle(String desc)
| Method Detail |
|---|
public static Rectangle parseRectangle(String desc)
public static String toString(Rectangle p)
Rectangle
class.
public String toString()
toString in class Rectanglepublic double distanceToEdge(Point2D inside)
public static double distanceToEdge(Rectangle2D rec,
Point2D inside)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||