TurtleGraphics
Class WigglePen

java.lang.Object
  extended by TurtleGraphics.AbstractPen
      extended by TurtleGraphics.StandardPen
          extended by TurtleGraphics.WigglePen
All Implemented Interfaces:
Pen
Direct Known Subclasses:
WiggleRainbowPen

public class WigglePen
extends StandardPen

Copyright 2006 by Ken Lambert and Martin Osborne.

Provides behavior and state for a pen with wiggles. The shape of the wiggles depends on a constant rate of wiggling and a wiggle angle. The default wiggle rate is 5 and the default wiggle angle is 30 degrees. The client can specify these values with a constructor.


Field Summary
 
Fields inherited from class TurtleGraphics.AbstractPen
color, direction, isDown, pad, width, xPos, yPos
 
Constructor Summary
WigglePen()
          Action: Pops up an application window containing a sketchpad and an associated wiggle pen with a wiggle rate of 5 and a wiggle angle of 30 degrees.
WigglePen(SketchPad pad, int w, double wa)
          Action: Associates a wiggle pen with the client's sketchpad using the client's wiggle rate and wiggle angle.
WigglePen(SketchPadWindow w)
          Action: Pops up the client's application window containing a sketchpad and an associated wiggle pen.
 
Method Summary
 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, drawString
 
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

WigglePen

public WigglePen()
Action: Pops up an application window containing a sketchpad and an associated wiggle pen with a wiggle rate of 5 and a wiggle angle of 30 degrees.


WigglePen

public WigglePen(SketchPad pad,
                 int w,
                 double wa)
Action: Associates a wiggle pen with the client's sketchpad using the client's wiggle rate and wiggle angle.

Parameters:
pad - The client's sketchpad
w - The number of wiggles or wiggle rate
wa - The wiggle angle in degrees

WigglePen

public WigglePen(SketchPadWindow w)
Action: Pops up the client's application window containing a sketchpad and an associated wiggle pen.

Method Detail

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