java.lang.Objectjava.lang.ThreadGroup
Stepper
The Stepper class can be attached to the turtle Canvas to control how fast things happen. It can move the turtles one step at a time, or set steps to happen continuously with a specified delay for each. There is only one Stepper instantiated; it can be retrieved with getStepper(). The Stepper manages a single "run" through the commands in Controller.run(). The run can be paused, stopped, restarted, or advanced a step at a time by various Stepper methods. There is only one run active a any time; any old runs are terminated when a new run begins.
| Field Summary |
| Fields inherited from class java.lang.ThreadGroup |
|
| Method Summary | |
void |
checkRun()
Check to make sure that you aren't part of a dead run. |
void |
didStep()
End a step of the run. |
void |
endRun()
Stop the current run, without waiting for it to finish. |
Canvas |
getCanvas()
Return the canvas that this Stepper is attached to. |
static Stepper |
getStepper()
Return the Stepper. |
boolean |
isStopped()
Check whether the stepper is stopped. |
void |
newRun()
Make a new run. |
void |
pause()
Pause the current run. |
void |
restart()
Restart the current run, if it was paused. |
void |
setScale(double setting)
The applet should call this when it wants to change the scale of the canvas. |
void |
setSpeed(int speed)
Set the speed for the run. |
void |
step()
Move the current run forward one step. |
| Methods inherited from class java.lang.ThreadGroup |
activeCount, activeGroupCount, allowThreadSuspension, checkAccess, destroy, enumerate, enumerate, enumerate, enumerate, getMaxPriority, getName, getParent, interrupt, isDaemon, isDestroyed, list, parentOf, resume, setDaemon, setMaxPriority, stop, suspend, toString, uncaughtException |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
public void checkRun()
public void didStep()
public void endRun()
public Canvas getCanvas()
public static Stepper getStepper()
public boolean isStopped()
public void newRun()
public void pause()
public void restart()
public void setScale(double setting)
setting - How big to draw, from 0 (tiny) to 4 (HUGE)public void setSpeed(int speed)
speed - Length of pause per step, from 0 (very fast) to 6 (slow)public void step()