Class Circle

java.lang.Object
  |
  +--Subject
        |
        +--Shape
              |
              +--Circle

public class Circle
extends Shape

A Circle is a Shape. Circles have all methods and attributes of Shape and then some more.


Constructor Summary
Circle()
          Initialize a red circle with radius 10, position 100,100
Circle(java.awt.Color c, int radius, int x, int y)
          Initialize a new circle with specified Color, radius and position
 
Method Summary
 void display(java.awt.Graphics g)
          produce a graphical representation of this
 int getRadius()
           
 void setRadius(int r)
          Set the radius of this circle and tell our observer that we have changed
 java.lang.String toString()
           
 
Methods inherited from class Shape
getColor, getX, getY, setColor, setPosition, setX, setY
 
Methods inherited from class Subject
attachObserver, detachObserver, notifyObserver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Circle

public Circle()
Initialize a red circle with radius 10, position 100,100

Circle

public Circle(java.awt.Color c,
              int radius,
              int x,
              int y)
Initialize a new circle with specified Color, radius and position
Parameters:
c - the desired color
r - the desired radius
x - the desired x coordinate
y - the desired x coordinate
Method Detail

setRadius

public void setRadius(int r)
Set the radius of this circle and tell our observer that we have changed
Parameters:
r - the desired radius
Returns:
nothing

getRadius

public int getRadius()
Returns:
the radius of this

toString

public java.lang.String toString()
Returns:
a String representation of this
Overrides:
toString in class Shape

display

public void display(java.awt.Graphics g)
produce a graphical representation of this
Parameters:
g - the pen we use to display this
Overrides:
display in class Shape