Constructor and Description |
---|
Rectangle()
Create a new rectangle instance.
|
Rectangle(int x,
int y,
int width,
int height)
Creates a new rectangle instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(int x,
int y)
Returns true if the point is within the rectangle's region.
|
boolean |
contains(Point p)
Returns true if the point is within the rectangle.
|
int |
getHeight() |
int |
getWidth() |
int |
getX() |
int |
getY() |
void |
setHeight(int height) |
void |
setWidth(int width) |
void |
setX(int x) |
void |
setY(int y) |
String |
toString() |
public Rectangle()
public Rectangle(int x, int y, int width, int height)
x
- the x valuey
- the y valuewidth
- the rectangle's widthheight
- the rectangle's heightpublic boolean contains(int x, int y)
x
- the x coordinate valuey
- the y coordinate valuepublic boolean contains(Point p)
p
- the pointpublic int getHeight()
public int getWidth()
public int getX()
public int getY()
public void setHeight(int height)
public void setWidth(int width)
public void setX(int x)
public void setY(int y)
Copyright © 2018. All rights reserved.