Class RectangleShape
java.lang.Object
AbstractShape
RectangleShape
public class RectangleShape
- extends AbstractShape
Class Rectangle: inherits from Shape and draws a rectangle
Copyright Georgia Institute of Technology 2007
- Author:
- Barb Ericson
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RectangleShape
public RectangleShape()
- No argument constructor
RectangleShape
public RectangleShape(Point firstPoint,
Point lastPoint)
- Constructor that takes two points to define the shape
- Parameters:
firstPoint
- first point used in defining the shapelastPoint
- last point used in defining the shape
RectangleShape
public RectangleShape(int x1,
int y1,
int x2,
int y2)
- Constructor that takes x1,y1,x2,y2
- Parameters:
x1
- x value of the first point that defines the shapey1
- y value of the first point that defines the shapex2
- x value of the second point that defines the shapey2
- y value of the second point that defines the shape
draw
public void draw(Graphics g)
- Draw the shape
- Specified by:
draw
in class AbstractShape
- Parameters:
g
- the graphics context on which to draw