Class java.awt.Rectangle
All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.Rectangle
java.lang.Object
|
+----java.awt.Rectangle
- public class Rectangle
- extends Object
An rectangle, defined by x, y, width and height.
-
height
- The height of the rectangle.
-
width
- The width of the rectangle.
-
x
- The x coordinate of the rectangle.
-
y
- The y coordinate of the rectangle.
-
Rectangle()
- Constructs a new rectangle.
-
Rectangle(int, int, int, int)
- Constructs and initializes a rectangle with the specified parameters.
-
Rectangle(int, int)
- Constructs a rectangle and initializes it with the specified width and
height parameters.
-
Rectangle(Point, Dimension)
- Constructs a rectangle and initializes it to specified point and
dimension.
-
Rectangle(Point)
- Constructs a rectangle and initializes it to the specified point.
-
Rectangle(Dimension)
- Constructs a rectangle and initializes it to the specified width and
height.
-
add(int, int)
- Add a point to a rectangle.
-
add(Point)
- Add a point to a rectangle.
-
add(Rectangle)
- Add a rectangle to a rectangle.
-
equals(Object)
- Check if two rectangles are equal.
-
grow(int, int)
- Grow the rectangle horizontally and vertically.
-
hashCode()
- Hashcode
-
inside(int, int)
- Checks if the specified point lies inside a rectangle.
-
intersection(Rectangle)
- Compute the intersection of two rectangles.
-
intersects(Rectangle)
- Check if two rectangles intersect.
-
isEmpty()
- Check if the rectangle is empty.
-
move(int, int)
- Move the rectangle.
-
reshape(int, int, int, int)
- Reshape the rectangle.
-
resize(int, int)
- Resize the rectangle.
-
toString()
- Returns the String representation of this Rectangle's values.
-
translate(int, int)
- Translate the rectangle.
-
union(Rectangle)
- Compute the union of two rectangles.
x
public int x
- The x coordinate of the rectangle.
y
public int y
- The y coordinate of the rectangle.
width
public int width
- The width of the rectangle.
height
public int height
- The height of the rectangle.
Rectangle
public Rectangle()
- Constructs a new rectangle.
Rectangle
public Rectangle(int x,
int y,
int width,
int height)
- Constructs and initializes a rectangle with the specified parameters.
- Parameters:
- x - the x coordinate
- y - the y coordinate
- width - the width of the rectangle
- height - the height of the rectangle
Rectangle
public Rectangle(int width,
int height)
- Constructs a rectangle and initializes it with the specified width and
height parameters.
- Parameters:
- width - the width of the rectangle
- height - the height of the rectangle
Rectangle
public Rectangle(Point p,
Dimension d)
- Constructs a rectangle and initializes it to specified point and
dimension.
- Parameters:
- p - the point
- d - dimension
Rectangle
public Rectangle(Point p)
- Constructs a rectangle and initializes it to the specified point.
- Parameters:
- p - the value of the x and y coordinate
Rectangle
public Rectangle(Dimension d)
- Constructs a rectangle and initializes it to the specified width and
height.
- Parameters:
- d - the value of the width and height
reshape
public void reshape(int x,
int y,
int width,
int height)
- Reshape the rectangle.
move
public void move(int x,
int y)
- Move the rectangle.
translate
public void translate(int x,
int y)
- Translate the rectangle.
resize
public void resize(int width,
int height)
- Resize the rectangle.
inside
public boolean inside(int x,
int y)
- Checks if the specified point lies inside a rectangle.
- Parameters:
- x - the x coordinate
- y - the y coordinate
intersects
public boolean intersects(Rectangle r)
- Check if two rectangles intersect.
intersection
public Rectangle intersection(Rectangle r)
- Compute the intersection of two rectangles.
union
public Rectangle union(Rectangle r)
- Compute the union of two rectangles.
add
public void add(int newx,
int newy)
- Add a point to a rectangle. This results in the smallest
rectangle that contains both the rectangle and the point
add
public void add(Point pt)
- Add a point to a rectangle. This results in the smallest
rectangle that contains both the rectangle and the point
add
public void add(Rectangle r)
- Add a rectangle to a rectangle. This results in the union
of the two rectangles.
grow
public void grow(int h,
int v)
- Grow the rectangle horizontally and vertically.
isEmpty
public boolean isEmpty()
- Check if the rectangle is empty.
hashCode
public int hashCode()
- Hashcode
- Overrides:
- hashCode in class Object
equals
public boolean equals(Object obj)
- Check if two rectangles are equal.
- Overrides:
- equals in class Object
toString
public String toString()
- Returns the String representation of this Rectangle's values.
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index