Class Shape

java.lang.Object
  extended byShape
Direct Known Subclasses:
CircleShape, OvalShape, RectangleShape

public abstract class Shape
extends Object

Abstract class Shape - Keeps information about the shape.

Version:
20050606
Author:
Peter Gadfort

Field Summary
private  Color color
          Color of the shape
private  int height
          Height of the shape
private  int width
          Width of the shape
private  int x
          X position of the shape
private  int y
          Y position of the shape
 
Constructor Summary
Shape(int x, int y, int width, int height, Color color)
          Constructor for the shapes.
 
Method Summary
abstract  void draw(Graphics g)
          Draws the shape on the input screen
 Color getColor()
          Returns the color of the shape
 int getHeight()
          Returns the height of the shape
 int getWidth()
          Returns the width of the shape
 int getX()
          Returns the x position of the shape
 int getY()
          Returns the y position of the shape
 void setColor(Color color)
          Sets the color to the new color
 void setHeight(int height)
          Sets the height to the new height
 void setWidth(int width)
          Sets the width to the new width
 void setX(int x)
          Sets the X to the new X
 void setY(int y)
          Sets the Y to the new Y
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

private int x
X position of the shape


y

private int y
Y position of the shape


height

private int height
Height of the shape


width

private int width
Width of the shape


color

private Color color
Color of the shape

Constructor Detail

Shape

public Shape(int x,
             int y,
             int width,
             int height,
             Color color)
Constructor for the shapes.

Parameters:
x - X position of the shape
y - position of the shape
height - Height of the shape
width - Width of the shape
color - Color of the shape
Method Detail

setX

public void setX(int x)
Sets the X to the new X

Parameters:
x - New x position

setY

public void setY(int y)
Sets the Y to the new Y

Parameters:
y - New y position

setHeight

public void setHeight(int height)
Sets the height to the new height

Parameters:
height - New height position

setWidth

public void setWidth(int width)
Sets the width to the new width

Parameters:
width - New width position

setColor

public void setColor(Color color)
Sets the color to the new color

Parameters:
color - New color position

getX

public int getX()
Returns the x position of the shape

Returns:
X position

getY

public int getY()
Returns the y position of the shape

Returns:
Y position

getHeight

public int getHeight()
Returns the height of the shape

Returns:
Height of the shape

getWidth

public int getWidth()
Returns the width of the shape

Returns:
Width of the shape

getColor

public Color getColor()
Returns the color of the shape

Returns:
Color of the shape

draw

public abstract void draw(Graphics g)
Draws the shape on the input screen

Parameters:
g - Graphics screen used to draw the shaep on