public class Rectangle extends AbstractRectangle implements Serializable
Modifier and Type | Field and Description |
---|---|
int |
height
The height of the rectangle.
|
int |
width
The width of the rectangle.
|
int |
x
The x-coordinate of the rectangle's upper left corner.
|
int |
y
The y-coordinate of the rectangle's upper left corner.
|
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
Constructor and Description |
---|
Rectangle()
Constructs a rectangle at (0,0) and with dimensions (0,0).
|
Rectangle(IDimension d)
Constructs a rectangle with upper-left corner at (0,0) and the supplied dimensions.
|
Rectangle(int x,
int y,
int width,
int height)
Constructs a rectangle with the specified upper-left corner and dimensions.
|
Rectangle(IPoint p)
Constructs a rectangle with the supplied upper-left corner and dimensions (0,0).
|
Rectangle(IPoint p,
IDimension d)
Constructs a rectangle with upper-left corner at the supplied point and with the supplied
dimensions.
|
Rectangle(IRectangle r)
Constructs a rectangle with bounds equal to the supplied rectangle.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int px,
int py)
Expands the bounds of this rectangle to contain the specified point.
|
void |
add(IPoint p)
Expands the bounds of this rectangle to contain the supplied point.
|
void |
add(IRectangle r)
Expands the bounds of this rectangle to contain the supplied rectangle.
|
void |
grow(int dx,
int dy)
Grows the bounds of this rectangle by the specified amount (i.e.
|
int |
height()
Returns the height of the framing rectangle.
|
void |
setBounds(int x,
int y,
int width,
int height)
Sets the bounds of this rectangle to the specified bounds.
|
void |
setBounds(IRectangle r)
Sets the bounds of this rectangle to those of the supplied rectangle.
|
void |
setLocation(int x,
int y)
Sets the upper-left corner of this rectangle to the specified point.
|
void |
setLocation(IPoint p)
Sets the upper-left corner of this rectangle to the supplied point.
|
void |
setSize(IDimension d)
Sets the size of this rectangle to the supplied dimensions.
|
void |
setSize(int width,
int height)
Sets the size of this rectangle to the specified dimensions.
|
void |
translate(int mx,
int my)
Translates the upper-left corner of this rectangle by the specified amount.
|
int |
width()
Returns the width of the framing rectangle.
|
int |
x()
Returns the x-coordinate of the upper-left corner of the framing rectangle.
|
int |
y()
Returns the y-coordinate of the upper-left corner of the framing rectangle.
|
public int x
public int y
public int width
public int height
public Rectangle()
public Rectangle(IPoint p)
public Rectangle(IDimension d)
public Rectangle(IPoint p, IDimension d)
public Rectangle(int x, int y, int width, int height)
public Rectangle(IRectangle r)
public void setLocation(int x, int y)
public void setLocation(IPoint p)
public void setSize(int width, int height)
public void setSize(IDimension d)
public void setBounds(int x, int y, int width, int height)
public void setBounds(IRectangle r)
public void grow(int dx, int dy)
public void translate(int mx, int my)
public void add(int px, int py)
public void add(IPoint p)
public void add(IRectangle r)
public int x()
IRectangle
x
in interface IRectangle
public int y()
IRectangle
y
in interface IRectangle
public int width()
IRectangle
width
in interface IRectangle
public int height()
IRectangle
height
in interface IRectangle
Copyright © 2017. All rights reserved.