public class Pen
extends java.lang.Object
Constructor and Description |
---|
Pen()
Create a new Pen and a new window for the pen.
|
Modifier and Type | Method and Description |
---|---|
void |
down()
Set the pen's state to down.
|
void |
erase()
Erase the window.
|
void |
home()
Send the pen to the home position and angle.
|
static void |
main(java.lang.String[] args)
Test the pen with the squiral method.
|
void |
move(int distance)
Move the pen the given distance.
|
void |
squiral(int steps,
int angle,
int distance)
Draw a squiral.
|
java.lang.String |
toString()
Return the pen's printed representation.
|
void |
turn(int degrees)
Turn the pen this many degrees counter-clockwise.
|
void |
up()
Raise the pen.
|
public Pen()
public void down()
public void up()
public void erase()
public void home()
public void turn(int degrees)
degrees
- a positive number is degrees to the "left"public void move(int distance)
public java.lang.String toString()
toString
in class java.lang.Object
public void squiral(int steps, int angle, int distance)
steps
- the number of steps (lines) to drawangle
- the amount to turn after each stepdistance
- the length by which to grow every third linepublic static void main(java.lang.String[] args)