|
||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uwcse.graphics.Pen
A simple Pen class which implements turtle style graphics. The pen has a position and an angle, and can be either up or down. All distances are in pixels. Angles are specified in degrees. Each pen automatically creates its own window.
Constructor Summary | |
Pen()
Create a new Pen and a new window for the pen. |
Method Summary | |
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. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Pen()
Method Detail |
public void down()
public void erase()
public void home()
public static void main(java.lang.String[] args)
public void move(int distance)
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 java.lang.String toString()
toString
in class java.lang.Object
public void turn(int degrees)
degrees
- a positive number is degrees to the "left"public void up()
|
||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |