public class TurtleDisplayer
extends java.lang.Object
implements java.util.Observer
Constructor and Description |
---|
TurtleDisplayer()
Creates a form with a Canvas of size 300x300, accompanied by other components
giving feedback on the turtle's status
|
TurtleDisplayer(Turtle t)
Creats a form with the specified Turtle on a Canvas of size 300x300,
accompanied by other componentsgiving feedback on the turtle's status
|
TurtleDisplayer(Turtle t,
int width,
int height)
Creates a TurtleDisplayer with a Canvas for a Turtle with the specified
width and height.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the TurtleDisplayer and frees resources when the user presses Close.
|
void |
hide()
Makes the TurtleDisplayer invisible, so that it can not be seen on the desktop.
|
void |
placeTurtle(Turtle t)
Puts a turtle onto the canvas on the form.
|
void |
setTurtle(Turtle t)
Deprecated.
use placeTurtle(Turtle t) instead
|
void |
show()
Makes the TurtleDisplayer visible, so that it can be seen on the desktop.
|
void |
update(java.util.Observable o,
java.lang.Object arg)
This method is only used by Observerable classes, ie Turtle.
|
void |
waitForUser()
Waits for the user to finish using the TurtleDisplayer and press OK.
|
public TurtleDisplayer(Turtle t, int width, int height)
t
- the turtle associated with this TurtleDisplayerwidth
- the width of the canvas on this formheight
- the height of the canvas on this formpublic TurtleDisplayer(Turtle t)
t
- A turtle that will go onto the canvasTurtleDisplayer(Turtle t, int width, int height)
public TurtleDisplayer()
public void setTurtle(Turtle t)
t
- the turtle to be place into the turtle canvas.public void placeTurtle(Turtle t)
t
- the turtle to be place into the turtle canvas.public void show()
public void hide()
public void waitForUser()
public void close()
public void update(java.util.Observable o, java.lang.Object arg)
update
in interface java.util.Observer