TurtleGraphics
Class RainbowPen

java.lang.Object
  extended by TurtleGraphics.AbstractPen
      extended by TurtleGraphics.StandardPen
          extended by TurtleGraphics.RainbowPen
All Implemented Interfaces:
Pen

public class RainbowPen
extends StandardPen

Copyright 2006 by Ken Lambert and Martin Osborne.

Provides behavior and state for a pen with randomly generated colors. A new random color is chosen for the pen each time it is moved or draws a string.


Field Summary
 
Fields inherited from class TurtleGraphics.AbstractPen
color, direction, isDown, pad, width, xPos, yPos
 
Constructor Summary
RainbowPen()
           
RainbowPen(SketchPad pad)
           
RainbowPen(SketchPadWindow w)
           
 
Method Summary
 void drawString(java.lang.String str)
          Action: Draws the string at the pen's position.
 void move(double distance)
          Action: The pen moves the specified distance in the current direction.
 void move(double x, double y)
          Action: Moves the pen to the position (x, y).
 
Methods inherited from class TurtleGraphics.StandardPen
drawLine
 
Methods inherited from class TurtleGraphics.AbstractPen
down, home, isDown, setColor, setDirection, setWidth, toString, turn, turn, up
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RainbowPen

public RainbowPen()

RainbowPen

public RainbowPen(SketchPad pad)

RainbowPen

public RainbowPen(SketchPadWindow w)
Method Detail

drawString

public void drawString(java.lang.String str)
Description copied from interface: Pen
Action: Draws the string at the pen's position.

Specified by:
drawString in interface Pen
Overrides:
drawString in class StandardPen

move

public void move(double distance)
Description copied from interface: Pen
Action: The pen moves the specified distance in the current direction. The distance can be an integer or floating-point number and is measured in pixels (picture elements). The size of a pixel depends on the monitorŐs resolution. For instance, when we say that a monitor's resolution is 800 by 600, we mean that the monitor is 800 pixels wide and 600 pixels high.

Specified by:
move in interface Pen
Overrides:
move in class AbstractPen

move

public void move(double x,
                 double y)
Description copied from interface: Pen
Action: Moves the pen to the position (x, y).

Specified by:
move in interface Pen
Overrides:
move in class AbstractPen