|
|||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--java.awt.Window
|
+--java.awt.Frame
|
+--TurtleGraphicsWindow
| Fields inherited from interface TGKeyHandler |
DOWN, ENTER, LEFT, RIGHT, SPACE, UP |
| Method Summary | |
void |
back(int steps)
Move the turtle backwards along its current heading. |
void |
bk(int steps)
Move the turtle backwards along its current heading. |
void |
clean()
Clears the graphics area of the TurtleGraphics window. |
int |
colorunder()
Return the color the Turtle is sitting on |
void |
fd(int steps)
Move the turtle forward along its current heading. |
void |
fill()
Fill a bounded area in the graphics image. |
void |
forward(int steps)
Move the turtle forward along its current heading. |
int |
heading()
Return the Turtle's heading |
void |
hideturtle()
Hide the turtle; make it invisible. |
void |
home()
Move the turtle to the center of the display. |
void |
ht()
Hide the turtle; make it invisible. |
boolean |
ispendown()
Return the current status of the pen. |
void |
keypressed(int keyNum)
|
void |
label(String text)
Paints a String of characters on the display. |
void |
left(int degrees)
Rotate the turtle counterclockwise by the specified angle, measured in degrees. |
void |
lt(int degrees)
Rotate the turtle counterclockwise by the specified angle, measured in degrees. |
void |
mouseclick()
|
int |
mousex()
Return the x-coordinate where last mouse click occured. |
int |
mousey()
Return the y-coordinate where last mouse click occured. |
void |
pd()
Put the turtle's pen in the down position. |
void |
pendown()
Put the turtle's pen in the down position. |
void |
penup()
Put the turtle's pen in the up position. |
void |
pu()
Put the turtle's pen in the up position. |
void |
right(int degrees)
Rotate the turtle clockwise by the specified angle, measured in degrees. |
void |
rt(int degrees)
Rotate the turtle clockwise by the specified angle, measured in degrees. |
void |
seth(int degrees)
Turns the turtle to the specified absolute heading. |
void |
setheading(int degrees)
Turns the turtle to the specified absolute heading. |
void |
setlabelheight(int size)
Set the size of the text displayed in the graphics area. |
void |
setpc(int color_Num)
Sets the color of the turtle's pen to the supplied number. |
void |
setpencolor(int color_Num)
Sets the color of the turtle's pen to the supplied number. |
void |
setpensize(int width)
Sets the width of the turtle's pen to the supplied number. |
void |
setx(int new_X)
Move the turtle to an absolute display position. |
void |
setxy(int new_X,
int new_Y)
Move the turtle to an absolute display position. |
void |
sety(int new_Y)
Move the turtle to an absolute display position. |
void |
showturtle()
Show the turtle; make it visible. |
void |
st()
Show the turtle; make it visible. |
int |
xcor()
Return the Turtle's X-coordinate |
int |
ycor()
Return the Turtle's Y-coordinate |
| Method Detail |
public void keypressed(int keyNum)
public void mouseclick()
public void bk(int steps)
Abbreviation for back(). Both spellings need to provided for compatibility.
steps - Number of pixels (in this implementation) to take.back(int)public void back(int steps)
Long name for bk(). Both spellings need to provided for compatibility.
steps - Number of pixels (in this implementation) to take.bk(int)public void clean()
Note: Clean does not change the current position of the turtle, its heading, the size of the pen it is drawing with and/or the color of the pen it is drawing with.
public int colorunder()
#pencolor,
setpc(int),
setpencolor(int)public void fill()
The current pixel, and any of its neighbors that are the same color as it (and any of their neighbors that are the same color as it, etc...) are changed to the current color.
public void fd(int steps)
Abbreviation for forward(). Both spellings need to provided for compatibility.
steps - Number of pixels (in this implementation) to take.forward(int)public void forward(int steps)
Long name for fd(). Both spellings need to provided for compatibility.
steps - Number of pixels (in this implementation) to take.fd(int)public int heading()
seth(int),
setheading(int)public void home()
Home is equivilent to setxy( 0, 0 )
setxy(int, int)public void ht()
Abbreviation for hideturtle(). Both spellings need to provided for compatibility.
hideturtle(),
showturtle(),
st()public void hideturtle()
Long name for ht(). Both spellings need to provided for compatibility.
ht(),
showturtle(),
st()public boolean ispendown()
Return true if the turtle's pen is down or false if it in the up position.
pendown(),
penup(),
pd(),
pu()public void label(String text)
The text is always painted in the standard horizontal manner, i.e., the heading of the turtle is ignored.
text - Characters to be painted on the display.public void left(int degrees)
degrees - Angle to change turtle's heading by.lt(int)public void lt(int degrees)
Abbreviation for left(). Both spellings need to provided for compatibility.
degrees - Angle to change turtle's heading by.left(int)public int mousex()
mousey()public int mousey()
mousex()public void pd()
When the turtle moves, it will leave a trace from its current position to its destination (its new position).
ispendown(),
pendown(),
pu(),
penup()public void pendown()
When the turtle moves, it will leave a trace from its current position to its destination (its new position).
ispendown(),
pd(),
penup(),
pu()public void penup()
When the turtle moves, it will leave no trace.
ispendown(),
pd(),
pendown(),
pu()public void pu()
When the turtle moves, it will leave no trace.
ispendown(),
pd(),
pendown(),
penup()public void setlabelheight(int size)
label(String)public void st()
Abbreviation for showturtle(). Both spellings need to provided for compatibility.
hideturtle(),
ht(),
showturtle()public void showturtle()
Long name for st(). Both spellings need to provided for compatibility.
hideturtle(),
ht(),
st()public void setx(int new_X)
Move the turtle horizontally to a new location specified as an X coordinate argument.
newX - the X-coordinate of destination.home(),
setxy(int, int),
sety(int)
public void setxy(int new_X,
int new_Y)
Move the turtle to the x and y coordinates provided as arguments.
newX - the X-coordinate of destination.newY - the Y-coordinate of destination.home(),
setx(int),
sety(int)public void sety(int new_Y)
Move the turtle vertically to a new location specified as an Y coordinate argument.
newY - the Y-coordinate of destination.home(),
setx(int),
setxy(int, int)public void right(int degrees)
degrees - Angle to change turtle's heading by.rt(int)public void rt(int degrees)
Abbreviation for right(). Both spellings need to provided for compatibility.
degrees - Angle to change turtle's heading by.right(int)public void seth(int degrees)
Abbreviation for setheading(). Both spellings need to provided for compatibility.
degrees - number of 1/360ths increments clockwise
from the positive Y axis.setheading(int)public void setheading(int degrees)
degrees - number of 1/360ths increments clockwise
from the positive Y axis.seth(int)public void setpc(int color_Num)
color_Num - numbers 0-15 are:
Number Color Number Color
------ ------- ------ -------
0 black 8 brown
1 blue 9 tan
2 green 10 forest
3 cyan 11 aqua
4 red 12 salmon
5 magenta 13 violet
6 yellow 14 orange
7 white 15 grey
Color numbers greater than 15 will be assumed to be RGB values with the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7. The actual color used in rendering will depend on finding the best match given the color space available for a given display.
setpencolor(int)public void setpencolor(int color_Num)
color_Num - numbers 0-15 are:
Number Color Number Color
------ ------- ------ -------
0 black 8 brown
1 blue 9 tan
2 green 10 forest
3 cyan 11 aqua
4 red 12 salmon
5 magenta 13 violet
6 yellow 14 orange
7 white 15 grey
Color numbers greater than 15 will be assumed to be RGB values with the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7. The actual color used in rendering will depend on finding the best match given the color space available for a given display.
setpencolor(int)public void setpensize(int width)
width - small positive number; 1 (or less) results
in a single pixel line. increasing numbers incrementally
add approximately 2 extra pixels in widthpublic int xcor()
setxy(int, int),
setx(int),
sety(int),
ycor()public int ycor()
setxy(int, int),
setx(int),
sety(int),
xcor()
|
||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||