Rectanglepublic class Rectangle extends Object
Fields Summary |
---|
public int | width | public int | height | public Point | origin |
Constructors Summary |
---|
public Rectangle()
// four constructors
origin = new Point(0, 0);
| public Rectangle(Point p)
origin = p;
| public Rectangle(int w, int h)
this(new Point(0, 0), w, h);
| public Rectangle(Point p, int w, int h)
origin = p;
width = w;
height = h;
|
Methods Summary |
---|
public int | area()
return width * height;
| public void | move(int x, int y)
origin.x = x;
origin.y = y;
|
|