becker.robots.icons
Class FlasherIcon

java.lang.Object
  extended by becker.robots.icons.Icon
      extended by becker.robots.icons.CompositeIcon
          extended by becker.robots.icons.AnimatedIcon
              extended by becker.robots.icons.FlasherIcon

public class FlasherIcon
extends AnimatedIcon

Display the current state of a Flasher, based on the flasher's current state. In particular, if the flasher is "on", then cycle between two images to simulate the flashing action of the flasher.

Author:
Byron Weber Becker

Field Summary
 
Fields inherited from class becker.robots.icons.Icon
transparent
 
Constructor Summary
FlasherIcon(Sim owner)
          Construct a new FlasherIcon with default colors, size and flash rate.
FlasherIcon(Sim owner, Color base, Color onColor, Color offColor, double relativeSize, int millisecondsPerFlash)
          Construct a new FlasherIcon.
FlasherIcon(Sim owner, double relativeSize)
          Construct a new FlasherIcon with default colors and flash rate.
FlasherIcon(Sim owner, double relativeSize, int millisecondsPerFlash)
          Construct a new FlasherIcon with default colors.
 
Method Summary
 Color getColor()
          Get the color of the flasher's base.
 void setColor(Color c)
          Set the color of the flasher's base.
 void stop()
          Stop the animation.
 
Methods inherited from class becker.robots.icons.AnimatedIcon
getImage, renderImage, setCurrentImage, start
 
Methods inherited from class becker.robots.icons.CompositeIcon
applyTransforms, componentIcon, hasChanged, markChanged, numComponents
 
Methods inherited from class becker.robots.icons.Icon
getLabel, getRotation, getSize, getTransparency, paintIcon, setLabel, setSize, setTransparency
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlasherIcon

public FlasherIcon(Sim owner,
                   Color base,
                   Color onColor,
                   Color offColor,
                   double relativeSize,
                   int millisecondsPerFlash)
Construct a new FlasherIcon.

Parameters:
owner - the owner of this icon, typically an instance of Flasher.
base - the desired color of the flasher's base.
onColor - the desired color of the light when it is on.
offColor - the desired color of the light when it is off.
relativeSize - a value between 0.0 (very small) and 1.0 (large).
millisecondsPerFlash - the number of milliseconds between flashes.

FlasherIcon

public FlasherIcon(Sim owner,
                   double relativeSize)
Construct a new FlasherIcon with default colors and flash rate.

Parameters:
owner - the owner of this icon, typically an instance of Flasher.
relativeSize - a value between 0.0 (very small) and 1.0 (large).

FlasherIcon

public FlasherIcon(Sim owner,
                   double relativeSize,
                   int millisecondsPerFlash)
Construct a new FlasherIcon with default colors.

Parameters:
owner - the owner of this icon, typically an instance of Flasher.
relativeSize - a value between 0.0 (very small) and 1.0 (large).
millisecondsPerFlash - the number of milliseconds between flashes.

FlasherIcon

public FlasherIcon(Sim owner)
Construct a new FlasherIcon with default colors, size and flash rate.

Parameters:
owner - the owner of this icon, typically an instance of Flasher.
Method Detail

stop

public void stop()
Description copied from class: AnimatedIcon
Stop the animation.

Overrides:
stop in class AnimatedIcon

getColor

public Color getColor()
Get the color of the flasher's base.

Overrides:
getColor in class AnimatedIcon
Returns:
this icon's current color.

setColor

public void setColor(Color c)
Set the color of the flasher's base.

Overrides:
setColor in class AnimatedIcon
Parameters:
c - The new color.