|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Light
Light class allows us to represent a circular light in a graphical context. Lights have one color when on and another when off. Lights know their coordiantes where they need to be drawn. They begin in their off color (lightGray), but each call to their switch method switches them from on to off or from off to on. A Light object is only drawn when its draw(Graphic) method is called from a paint() method.
Constructor Summary | |
Light(int size,
java.awt.Color onColor,
int x,
int y)
Construct a new Light with provided info. |
Method Summary | |
void |
draw(java.awt.Graphics g)
Draw the light using g |
boolean |
on()
Return Light's on/off status. |
java.awt.Color |
onColor()
Return Light's on color. |
int |
size()
Return Light's size. |
void |
switchLight()
Turn a light on, if off, and off, if on. |
int |
x()
Return Light's x-coordinate. |
int |
y()
Return Light's y-coordinate. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Light(int size, java.awt.Color onColor, int x, int y)
Method Detail |
public void switchLight()
public void draw(java.awt.Graphics g)
public boolean on()
public java.awt.Color onColor()
public int size()
public int x()
public int y()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |