Class RectangleShape

java.lang.Object
  extended by AbstractShape
      extended by RectangleShape

public class RectangleShape
extends AbstractShape

Class Rectangle: inherits from Shape and draws a rectangle Copyright Georgia Institute of Technology 2007

Author:
Barb Ericson

Field Summary
 
Fields inherited from class AbstractShape
color, OVAL, p1, p2, RECTANGLE
 
Constructor Summary
RectangleShape()
          No argument constructor
RectangleShape(int x1, int y1, int x2, int y2)
          Constructor that takes x1,y1,x2,y2
RectangleShape(Point firstPoint, Point lastPoint)
          Constructor that takes two points to define the shape
 
Method Summary
 void draw(Graphics g)
          Draw the shape
 
Methods inherited from class AbstractShape
getHeight, getMinX, getMinY, getWidth, setPoint1Values, setPoint2Values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 shape
lastPoint - 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 shape
y1 - y value of the first point that defines the shape
x2 - x value of the second point that defines the shape
y2 - y value of the second point that defines the shape
Method Detail

draw

public void draw(Graphics g)
Draw the shape

Specified by:
draw in class AbstractShape
Parameters:
g - the graphics context on which to draw