Class TurtleGraphicsWindow

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by TurtleGraphicsWindow
All Implemented Interfaces:
java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, TGKeyHandler, TGMouseHandler

public class TurtleGraphicsWindow
extends java.awt.Frame
implements TGKeyHandler, TGMouseHandler, java.awt.event.WindowListener

Wrapper class which provides the TurtleGraphics support from the TG Logo programmng environment to the world of programming in Java.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int AQUA
          Symbolic constant for input to setpencolor().
static int ARROW
          jLogo comes with a few basic shapes (images) that the turtle may take on.
static int BALL
          jLogo comes with a few basic shapes (images) that the turtle may take on.
static int BLACK
          The setpencolor method's input is a built-in color number or an RGB value.
static int BLUE
          Symbolic constant for input to setpencolor().
static int BOX
          jLogo comes with a few basic shapes (images) that the turtle may take on.
static int BROWN
          Symbolic constant for input to setpencolor().
static int CHOCOLATE
          Symbolic constant for input to setpencolor().
static int COURIER
          Symbolic constant for setlabelfont() to select a fixed-width Courier font.
static int COURIER_BOLD
          Symbolic constant for setlabelfont() to select an emboldened fixed-width Courier font.
static int COURIER_BOLD_ITALIC
          Symbolic constant for setlabelfont() to select an emboldened and italicized fixed-width Courier font.
static int COURIER_ITALIC
          Symbolic constant for setlabelfont() to select an italicized fixed-width Courier font.
static int CROSS
          jLogo comes with a few basic shapes (images) that the turtle may take on.
static int CYAN
          Symbolic constant for input to setpencolor().
static int DEFAULT_CANVAS_HEIGHT
          Default height of the graphics canvas.
static int DEFAULT_CANVAS_WIDTH
          Default width of the graphics canvas.
static int DIAMOND
          jLogo comes with a few basic shapes (images) that the turtle may take on.
static int EAST
          Turtle heading for the positive X axis.
static int FIRST_USER_SUPPLIED_SHAPE
          The minimum shape number that users can assign an image of their own to.
static int FOREST
          Symbolic constant for input to setpencolor().
static int GOLD
          Symbolic constant for input to setpencolor().
static int GRAY
          Symbolic constant for input to setpencolor().
static int GREEN
          Symbolic constant for input to setpencolor().
static int KHAKI
          Symbolic constant for input to setpencolor().
static int LAST_USER_SUPPLIED_SHAPE
          The maximum shape number that users can assign an image of their own to.
static int LAWNGREEN
          Symbolic constant for input to setpencolor().
static int LIGHTBLUE
          Symbolic constant for input to setpencolor().
static int LIGHTGRAY
          Symbolic constant for input to setpencolor().
static int LIME
          Symbolic constant for input to setpencolor().
static int LINECAP_BUTT
          Symbolic constant for setLinecap() which selects a basic line with no endcap.
static int LINECAP_ROUND
          Symbolic constant for setLinecap() to which selects a rounded endcap.
static int LINECAP_SQUARE
          Symbolic constant for setLinecap() to which selects a squared-off endcap.
static int MAGENTA
          Symbolic constant for input to setpencolor().
static int MAX_LOGO_COLOR
          The maximum value for a built-in color which require conversion to RGB colors used by Java.
static int NAVY
          Symbolic constant for input to setpencolor().
static int NORTH
          Turtle heading for the positive Y axis.
static int NUM_USER_SUPPLIED_SHAPES
          The number of shape numbers reserved for users to assign their own images to.
static int OLIVE
          Symbolic constant for input to setpencolor().
static int ORANGE
          Symbolic constant for input to setpencolor().
static int PALEGREEN
          Symbolic constant for input to setpencolor().
static int PERU
          Symbolic constant for input to setpencolor().
static int PINK
          Symbolic constant for input to setpencolor().
static int PURPLE
          Symbolic constant for input to setpencolor().
static int RED
          Symbolic constant for input to setpencolor().
static int SALMON
          Symbolic constant for input to setpencolor().
static int SANS_SERIF
          Symbolic constant for setlabelfont() to select the Sans Serif font.
static int SANS_SERIF_BOLD
          Symbolic constant for setlabelfont() to select an emboldened Sans Serif font.
static int SANS_SERIF_BOLD_ITALIC
          Symbolic constant for setlabelfont() to select an emboldened and italicized Sans Serif font.
static int SANS_SERIF_ITALIC
          Symbolic constant for setlabelfont() to select an italicized Sans Serif font.
static int SERIF
          Symbolic constant for setlabelfont() to select the Serif font.
static int SERIF_BOLD
          Symbolic constant for setlabelfont() to select an emboldened Serif font.
static int SERIF_BOLD_ITALIC
          Symbolic constant for setlabelfont() to select an emboldened and italicized Serif font.
static int SERIF_ITALIC
          Symbolic constant for setlabelfont() to select an italicized Serif font.
static int SKYBLUE
          Symbolic constant for input to setpencolor().
static int SOUTH
          Turtle heading for the negative Y axis.
static int STEELBLUE
          Symbolic constant for input to setpencolor().
static int TAN
          Symbolic constant for input to setpencolor().
static int TRIANGLE
          jLogo comes with a few basic shapes (images) that the turtle may take on.
static int TURTLE
          jLogo comes with a few basic shapes (images) that the turtle may take on.
static int VIOLET
          Symbolic constant for input to setpencolor().
static int WEST
          Turtle heading for the negative X axis.
static int WHEAT
          Symbolic constant for input to setpencolor().
static int WHITE
          Symbolic constant for input to setpencolor().
static int YELLOW
          Symbolic constant for input to setpencolor().
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface TGKeyHandler
ALT, CONTROL, DOWN, DOWN_ARROW, LEFT, LEFT_ARROW, RIGHT, RIGHT_ARROW, SHIFT, UP, UP_ARROW
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TurtleGraphicsWindow()
          Create and return an AWT Frame which contains a turtle graphics canvas.
TurtleGraphicsWindow(int width, int height)
          Create and return an AWT Frame which contains a turtle graphics Canvas.
 
Method Summary
 void arc(double angle, double radius)
          Draws an arc of a circle, with the turtle at the center, with the specified radius, starting at the turtle's heading and extending clockwise through the specified angle.
 void arc(int angle, int radius)
          Draws an arc of a circle, with the turtle at the center, with the specified radius, starting at the turtle's heading and extending clockwise through the specified angle.
 void back(double steps)
          Move the turtle backwards along its current heading.
 void back(int steps)
          Move the turtle backwards along its current heading.
 void bk(double steps)
          Move the turtle backwards along its current heading.
 void bk(int steps)
          Move the turtle backwards along its current heading.
 void clean()
          Clear the graphics canvas area of the TurtleGraphicsWindow.
 int[] colorsunder()
          Return an array of the unique colors this turtle's image is positioned over.
 int colorunder()
          Return the color under the center of the turtle's image.
 void fd(double steps)
          Move the turtle forward along its current heading.
 void fd(int steps)
          Move the turtle forward along its current heading.
 void fill()
          Fill a bounded area in the graphics canvas.
 void forward(double steps)
          Move the turtle forward along its current heading.
 void forward(int steps)
          Move the turtle forward along its current heading.
 double heading()
          Return the turtle's heading in Logo (turtle space) degrees.
 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)
          Deprecated.  
 void label(java.lang.String text)
          Draws a String of characters on the graphics canvas.
 int labelwidth(java.lang.String label)
          Return the width of the provided String, when rendered in the current font, in turtle steps (pixels).
 void left(double degrees)
          Rotate the turtle counterclockwise by the specified angle, measured in degrees.
 void left(int degrees)
          Rotate the turtle counterclockwise by the specified angle, measured in degrees.
 boolean loadpicture(java.lang.String fileName)
          Draw a picture from a file onto the background of the graphics canvas.
 boolean loadshape(java.lang.String fileName, int shapeNum)
          Load an image file; it can then be used for a turtle's shape, its image.
 void lt(double 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.
 int mousex()
          Return the x-coordinate where the mouse was last moved or clicked within the graphics canvas.
 int mousey()
          Return the Y-coordinate where the mouse was last moved or clicked within the graphics canvas.
 void pd()
          Lower the turtle's pen into the down position.
 int pencolor()
          Return the color the pen is currently drawing in.
 void pendown()
          Lower the turtle's pen into the down position.
 void penup()
          Lift the turtle's pen into the up position.
 TGPoint pos()
          Return the current position of this turtle.
 void pu()
          Lift the turtle's pen into the up position.
 void right(double degrees)
          Rotate the turtle clockwise by the specified angle, measured in degrees.
 void right(int degrees)
          Rotate the turtle clockwise by the specified angle, measured in degrees.
 void rt(double 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 setbg(int logoColor)
          Set the background color of the graphics canvas.
 void seth(double degrees)
          Turns the turtle to the specified absolute heading.
 void seth(int degrees)
          Turns the turtle to the specified absolute heading.
 void setheading(double degrees)
          Turns the turtle to the specified absolute heading.
 void setheading(int degrees)
          Turns the turtle to the specified absolute heading.
 void setlabelfont(int fontNumber)
          Set the font for LABELs, text drawn on the graphics canvas by the turtle.
 void setlabelheight(int size)
          Set the height of the text drawn on the graphics canvas with the label() method.
 void setlinecap(int typeLinecap)
          Set the type of linecaps applied to the ends of lines drawn.
 void setpc(int colorNum)
          Sets the color of the turtle's pen to the supplied number.
 void setpencolor(int colorNum)
          Sets the color of the turtle's pen to the supplied number.
 void setpenpattern(int segmentSize)
          Set the pattern used to draw lines.
 void setpenpattern(int[] pattern)
          Set the pattern used to draw lines.
 void setpensize(int width)
          Sets the width of the turtle's pen to the supplied number.
 void setpos(TGPoint pos)
          Move the turtle to an absolute display position, to the x and y coordinates in the TGPoint parameter.
 boolean setshape(int shapeNum)
          Sets the shape of the turtle - its pixel image.
 boolean setshape(int shapeNum, int[] params)
          Sets the shape of the turtle - its pixel image.
 void setshape(SpritePixels newSpritePixels)
          Sets the shape of the turtle - its pixel image.
 void setx(double newX)
          Move the turtle to an absolute display position.
 void setx(int newX)
          Move the turtle to an absolute display position.
 void setxy(double newX, double newY)
          Move the turtle to an absolute display position.
 void setxy(int newX, int newY)
          Move the turtle to an absolute display position.
 void setxy(TGPoint newPt)
          Move the turtle to an absolute display position.
 void sety(double newY)
          Move the turtle to an absolute display position.
 void sety(int newY)
          Move the turtle to an absolute display position.
 int shapeheight()
          Return the height of the image of the turtle, as it appears for its current heading.
 int shapewidth()
          Return the width of the image of the turtle, as it appears for its current heading.
 boolean shownp()
          Return true if this turtle's image is being displayed on the graphics canvas, else return false.
 void showturtle()
          Show the turtle; make it visible.
 void st()
          Show the turtle; make it visible.
 void stamp()
          Draw the turtle's image onto the graphics canvas.
 void tgKeyPressed(int keyNum)
          TurtleGraphicsWindow implements the TGKeyHandler interface and registers with TGCanvas to receive keyboard key events.
 void tgKeyReleased(int keyNum)
          TurtleGraphicsWindow implements the TGKeyHandler interface and registers with TGCanvas to receive keyboard key events.
 void tgKeyTyped(char keyChar)
          TurtleGraphicsWindow implements the TGKeyHandler interface and registers with TGCanvas to receive keyboard key events.
 void tgMouseClicked(int x, int y)
          TurtleGraphicsWindow implements the TGMouseHandler interface and registers with TGCanvas to receive mouse events.
 void tgMouseMoved(int x, int y)
          TurtleGraphicsWindow implements the TGMouseHandler interface and registers with TGCanvas to receive mouse events.
 void throttle(int amt)
          Set the amount of time (milliseconds) that drawing is suspended each time a method which visibly changes the turtle's state is performed.
 void windowActivated(java.awt.event.WindowEvent we)
           
 void windowClosed(java.awt.event.WindowEvent we)
           
 void windowClosing(java.awt.event.WindowEvent we)
           
 void windowDeactivated(java.awt.event.WindowEvent we)
           
 void windowDeiconified(java.awt.event.WindowEvent we)
           
 void windowIconified(java.awt.event.WindowEvent we)
           
 void windowOpened(java.awt.event.WindowEvent we)
           
 int xcor()
          Return the turtle's X-coordinate
 int ycor()
          Return the turtle's Y-coordinate
 
Methods inherited from class java.awt.Frame
addNotify, getAccessibleContext, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, paramString, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

DEFAULT_CANVAS_HEIGHT

public static final int DEFAULT_CANVAS_HEIGHT
Default height of the graphics canvas.

See Also:
Constant Field Values

DEFAULT_CANVAS_WIDTH

public static final int DEFAULT_CANVAS_WIDTH
Default width of the graphics canvas.

See Also:
Constant Field Values

BLACK

public static final int BLACK
The setpencolor method's input is a built-in color number or an RGB value. Built-in colors numbers are in the range of 0-31.

See Also:
Constant Field Values

BLUE

public static final int BLUE
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

GREEN

public static final int GREEN
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

CYAN

public static final int CYAN
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

RED

public static final int RED
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

MAGENTA

public static final int MAGENTA
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

YELLOW

public static final int YELLOW
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

WHITE

public static final int WHITE
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

BROWN

public static final int BROWN
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

TAN

public static final int TAN
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

FOREST

public static final int FOREST
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

AQUA

public static final int AQUA
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

SALMON

public static final int SALMON
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

VIOLET

public static final int VIOLET
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

ORANGE

public static final int ORANGE
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

GRAY

public static final int GRAY
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

NAVY

public static final int NAVY
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

SKYBLUE

public static final int SKYBLUE
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

LIME

public static final int LIME
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

STEELBLUE

public static final int STEELBLUE
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

CHOCOLATE

public static final int CHOCOLATE
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

PURPLE

public static final int PURPLE
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

GOLD

public static final int GOLD
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

LIGHTGRAY

public static final int LIGHTGRAY
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

PERU

public static final int PERU
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

WHEAT

public static final int WHEAT
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

PALEGREEN

public static final int PALEGREEN
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

LIGHTBLUE

public static final int LIGHTBLUE
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

KHAKI

public static final int KHAKI
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

PINK

public static final int PINK
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

LAWNGREEN

public static final int LAWNGREEN
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

OLIVE

public static final int OLIVE
Symbolic constant for input to setpencolor().

See Also:
Constant Field Values

MAX_LOGO_COLOR

public static final int MAX_LOGO_COLOR
The maximum value for a built-in color which require conversion to RGB colors used by Java.

See Also:
Constant Field Values

COURIER

public static final int COURIER
Symbolic constant for setlabelfont() to select a fixed-width Courier font.

See Also:
setlabelfont(int), Constant Field Values

COURIER_BOLD

public static final int COURIER_BOLD
Symbolic constant for setlabelfont() to select an emboldened fixed-width Courier font.

See Also:
setlabelfont(int), Constant Field Values

COURIER_ITALIC

public static final int COURIER_ITALIC
Symbolic constant for setlabelfont() to select an italicized fixed-width Courier font.

See Also:
setlabelfont(int), Constant Field Values

COURIER_BOLD_ITALIC

public static final int COURIER_BOLD_ITALIC
Symbolic constant for setlabelfont() to select an emboldened and italicized fixed-width Courier font.

See Also:
setlabelfont(int), Constant Field Values

SANS_SERIF

public static final int SANS_SERIF
Symbolic constant for setlabelfont() to select the Sans Serif font.

See Also:
setlabelfont(int), Constant Field Values

SANS_SERIF_BOLD

public static final int SANS_SERIF_BOLD
Symbolic constant for setlabelfont() to select an emboldened Sans Serif font.

See Also:
setlabelfont(int), Constant Field Values

SANS_SERIF_ITALIC

public static final int SANS_SERIF_ITALIC
Symbolic constant for setlabelfont() to select an italicized Sans Serif font.

See Also:
setlabelfont(int), Constant Field Values

SANS_SERIF_BOLD_ITALIC

public static final int SANS_SERIF_BOLD_ITALIC
Symbolic constant for setlabelfont() to select an emboldened and italicized Sans Serif font.

See Also:
setlabelfont(int), Constant Field Values

SERIF

public static final int SERIF
Symbolic constant for setlabelfont() to select the Serif font.

See Also:
setlabelfont(int), Constant Field Values

SERIF_BOLD

public static final int SERIF_BOLD
Symbolic constant for setlabelfont() to select an emboldened Serif font.

See Also:
setlabelfont(int), Constant Field Values

SERIF_ITALIC

public static final int SERIF_ITALIC
Symbolic constant for setlabelfont() to select an italicized Serif font.

See Also:
setlabelfont(int), Constant Field Values

SERIF_BOLD_ITALIC

public static final int SERIF_BOLD_ITALIC
Symbolic constant for setlabelfont() to select an emboldened and italicized Serif font.

See Also:
setlabelfont(int), Constant Field Values

NORTH

public static final int NORTH
Turtle heading for the positive Y axis. The Logo turtle's heading in degrees does not match the standard mathematics notion of having the positive X axis as zero, with degrees increasing counter-clockwise. Logo has the positive Y axis as zero with degrees increasing clockwise. The use of abstract symbolic constants for north, east, south, and west help.

See Also:
seth(double), setheading(double), Constant Field Values

EAST

public static final int EAST
Turtle heading for the positive X axis. The Logo turtle's heading in degrees does not match the standard mathematics notion of having the positive X axis as zero, with degrees increasing counter-clockwise. Logo has the positive Y axis as zero with degrees increasing clockwise. The use of abstract symbolic constants for north, east, south, and west help.

See Also:
seth(double), setheading(double), Constant Field Values

SOUTH

public static final int SOUTH
Turtle heading for the negative Y axis. The Logo turtle's heading in degrees does not match the standard mathematics notion of having the positive X axis as zero, with degrees increasing counter-clockwise. Logo has the positive Y axis as zero with degrees increasing clockwise. The use of abstract symbolic constants for north, east, south, and west help.

See Also:
seth(double), setheading(double), Constant Field Values

WEST

public static final int WEST
Turtle heading for the negative X axis. The Logo turtle's heading in degrees does not match the standard mathematics notion of having the positive X axis as zero, with degrees increasing counter-clockwise. Logo has the positive Y axis as zero with degrees increasing clockwise. The use of abstract symbolic constants for north, east, south, and west help.

See Also:
seth(double), setheading(double), Constant Field Values

TURTLE

public static final int TURTLE
jLogo comes with a few basic shapes (images) that the turtle may take on. Each is assigned a fixed shape number. The initial shape roughly looks like a turtle (come-on... think artististic license). This default turtle image is shape number 0.

See Also:
Constant Field Values

ARROW

public static final int ARROW
jLogo comes with a few basic shapes (images) that the turtle may take on. Each is assigned a fixed shape number. An image which resembles an arrow is shape number 1.

See Also:
Constant Field Values

BALL

public static final int BALL
jLogo comes with a few basic shapes (images) that the turtle may take on. Each is assigned a fixed shape number. An image which is a filled circle, a ball, is shape number 2.

See Also:
Constant Field Values

BOX

public static final int BOX
jLogo comes with a few basic shapes (images) that the turtle may take on. Each is assigned a fixed shape number. An image which is a filled rectangle, a box, is shape number 3.

See Also:
Constant Field Values

CROSS

public static final int CROSS
jLogo comes with a few basic shapes (images) that the turtle may take on. Each is assigned a fixed shape number. An image which resembles a filled plus-sign, a cross, is shape number 4.

See Also:
Constant Field Values

TRIANGLE

public static final int TRIANGLE
jLogo comes with a few basic shapes (images) that the turtle may take on. Each is assigned a fixed shape number. An image which is a filled triangle is shape number 5.

See Also:
Constant Field Values

DIAMOND

public static final int DIAMOND
jLogo comes with a few basic shapes (images) that the turtle may take on. Each is assigned a fixed shape number. An image which is a filled diamond is shape number 6.

See Also:
Constant Field Values

LINECAP_BUTT

public static final int LINECAP_BUTT
Symbolic constant for setLinecap() which selects a basic line with no endcap.

See Also:
Constant Field Values

LINECAP_ROUND

public static final int LINECAP_ROUND
Symbolic constant for setLinecap() to which selects a rounded endcap. This is the default.

See Also:
Constant Field Values

LINECAP_SQUARE

public static final int LINECAP_SQUARE
Symbolic constant for setLinecap() to which selects a squared-off endcap.

See Also:
Constant Field Values

FIRST_USER_SUPPLIED_SHAPE

public static final int FIRST_USER_SUPPLIED_SHAPE
The minimum shape number that users can assign an image of their own to.

See Also:
Constant Field Values

NUM_USER_SUPPLIED_SHAPES

public static final int NUM_USER_SUPPLIED_SHAPES
The number of shape numbers reserved for users to assign their own images to.

See Also:
Constant Field Values

LAST_USER_SUPPLIED_SHAPE

public static final int LAST_USER_SUPPLIED_SHAPE
The maximum shape number that users can assign an image of their own to.

See Also:
Constant Field Values
Constructor Detail

TurtleGraphicsWindow

public TurtleGraphicsWindow()
Create and return an AWT Frame which contains a turtle graphics canvas. It comes with a full set of methods (actually wrappers for Sprite methods) for performing Logo-like turtle graphics stuff. It has a default size of symbolic constants DEFAULT_CANVAS_HEIGHT and DEFAULT_CANVAS_WIDTH.


TurtleGraphicsWindow

public TurtleGraphicsWindow(int width,
                            int height)
Create and return an AWT Frame which contains a turtle graphics Canvas. It comes with a full set of methods (actually wrappers for Sprite methods) for performing Logo-like turtle graphics stuff. Its size is provided as parameters.

Method Detail

tgKeyPressed

public void tgKeyPressed(int keyNum)
TurtleGraphicsWindow implements the TGKeyHandler interface and registers with TGCanvas to receive keyboard key events.

Override this method to do something when a key on the keyboard is pressed while the graphics canvas is active, has focus.

Specified by:
tgKeyPressed in interface TGKeyHandler
Parameters:
keyNum - key identifier - either a character or an action key code (e.g., arrow keys)
See Also:
TGKeyHandler.ALT, TGKeyHandler.CONTROL, TGKeyHandler.DOWN_ARROW, TGKeyHandler.LEFT_ARROW, TGKeyHandler.RIGHT_ARROW, TGKeyHandler.SHIFT, TGKeyHandler.UP_ARROW

tgKeyReleased

public void tgKeyReleased(int keyNum)
TurtleGraphicsWindow implements the TGKeyHandler interface and registers with TGCanvas to receive keyboard key events.

Override this method to do something when a key which generates a character is pressed and released while the graphics canvas is active, has focus.

Specified by:
tgKeyReleased in interface TGKeyHandler
Parameters:
keyNum - key identifier - either a character or an action key code (e.g., arrow keys)
See Also:
TGKeyHandler.ALT, TGKeyHandler.CONTROL, TGKeyHandler.DOWN_ARROW, TGKeyHandler.LEFT_ARROW, TGKeyHandler.RIGHT_ARROW, TGKeyHandler.SHIFT, TGKeyHandler.UP_ARROW

tgKeyTyped

public void tgKeyTyped(char keyChar)
TurtleGraphicsWindow implements the TGKeyHandler interface and registers with TGCanvas to receive keyboard key events.

Override this method to do something when a key on the keyboard is released while the graphics canvas is active, has focus.

Specified by:
tgKeyTyped in interface TGKeyHandler
Parameters:
keyChar - a character generated by a keyboard key

tgMouseClicked

public void tgMouseClicked(int x,
                           int y)
TurtleGraphicsWindow implements the TGMouseHandler interface and registers with TGCanvas to receive mouse events.

Override this method to do something when the left mouse button is clicked in the graphics canvas while it is active, has focus.

Specified by:
tgMouseClicked in interface TGMouseHandler
Parameters:
x - the X-coordinate where mouse was clicked
y - the Y-coordinate where mouse was clicked
See Also:
mousex(), mousey(), tgMouseMoved(int, int)

tgMouseMoved

public void tgMouseMoved(int x,
                         int y)
TurtleGraphicsWindow implements the TGMouseHandler interface and registers with TGCanvas to receive mouse events.

Override this method to do something when the mouse is moved within the graphics canvas while it is active, has focus.

Specified by:
tgMouseMoved in interface TGMouseHandler
Parameters:
x - the X-coordinate where mouse was clicked.
y - the Y-coordinate where mouse was clicked.
See Also:
mousex(), mousey(), tgMouseClicked(int, int)

windowActivated

public void windowActivated(java.awt.event.WindowEvent we)
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent we)
Specified by:
windowClosed in interface java.awt.event.WindowListener

windowClosing

public void windowClosing(java.awt.event.WindowEvent we)
Specified by:
windowClosing in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent we)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent we)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent we)
Specified by:
windowIconified in interface java.awt.event.WindowListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent we)
Specified by:
windowOpened in interface java.awt.event.WindowListener

arc

public void arc(double angle,
                double radius)
         throws java.lang.IllegalArgumentException
Draws an arc of a circle, with the turtle at the center, with the specified radius, starting at the turtle's heading and extending clockwise through the specified angle. The turtle is not moved.

Parameters:
angle - clockwise rotation from current heading (in degrees)
radius - distance from center of the turtle to the drawn arc, to the center of the arc line if the pen width is greater than 1.
Throws:
java.lang.IllegalArgumentException

arc

public void arc(int angle,
                int radius)
         throws java.lang.IllegalArgumentException
Draws an arc of a circle, with the turtle at the center, with the specified radius, starting at the turtle's heading and extending clockwise through the specified angle. The turtle is not moved.

Parameters:
angle - clockwise rotation from current heading (in degrees)
radius - distance from center of the turtle to the drawn arc, to the center of the arc line if the pen width is greater than 1.
Throws:
java.lang.IllegalArgumentException

back

public void back(double steps)
Move the turtle backwards along its current heading. If the pen is currently in the DOWN position, a line is drawn. Long name for bk(). Both spellings need to provided for compatibility.

Parameters:
steps - number of turtle steps to move
See Also:
bk(double)

back

public void back(int steps)
Move the turtle backwards along its current heading. If the pen is currently in the DOWN position, a line is drawn. Long name for bk(). Both spellings need to provided for compatibility.

Parameters:
steps - number of turtle steps to move
See Also:
bk(double)

bk

public void bk(double steps)
Move the turtle backwards along its current heading. If the pen is currently in the DOWN position, a line is drawn. Long name for bk(). Both spellings need to provided for compatibility.

Parameters:
steps - number of turtle steps to move
See Also:
bk(double)

bk

public void bk(int steps)
Move the turtle backwards along its current heading. If the pen is currently in the DOWN position, a line is drawn. Abbreviation for back(). Both spellings need to provided for compatibility.

Parameters:
steps - Number of turtle steps to move
See Also:
back(double)

clean

public void clean()
Clear the graphics canvas area of the TurtleGraphicsWindow. 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.


colorsunder

public int[] colorsunder()
Return an array of the unique colors this turtle's image is positioned over.

See Also:
pencolor(), setbg(int), setpc(int), setpencolor(int)

colorunder

public int colorunder()
Return the color under the center of the turtle's image.

See Also:
pencolor(), setpc(int), setpencolor(int)

fill

public void fill()
Fill a bounded area in the graphics canvas. 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.


fd

public void fd(double steps)
Move the turtle forward along its current heading. If the pen is currently in the DOWN position, a line is drawn. Abbreviation for forward(). Both spellings need to be provided for compatibility.

Parameters:
steps - Number of turtle steps to take.
See Also:
forward(double)

fd

public void fd(int steps)
Move the turtle forward along its current heading. If the pen is currently in the DOWN position, a line is drawn. Abbreviation for forward(). Both spellings need to be provided for compatibility.

Parameters:
steps - Number of turtle steps to take.
See Also:
forward(double)

forward

public void forward(double steps)
Move the turtle forward along its current heading. If the pen is currently in the DOWN position, a line is drawn. Long name for fd(). Both spellings need to provided for compatibility.

Parameters:
steps - number of turtle steps to move in current direction
See Also:
fd(double)

forward

public void forward(int steps)
Move the turtle forward along its current heading. If the pen is currently in the DOWN position, a line is drawn. Long name for fd(). Both spellings need to provided for compatibility.

Parameters:
steps - number of turtle steps to move in current direction
See Also:
fd(double)

labelwidth

public int labelwidth(java.lang.String label)
Return the width of the provided String, when rendered in the current font, in turtle steps (pixels).

Parameters:
label - text to be measured
See Also:
label(java.lang.String), setlabelfont(int), setlabelheight(int)

heading

public double heading()
Return the turtle's heading in Logo (turtle space) degrees.

See Also:
seth(double), setheading(double)

hideturtle

public void hideturtle()
Hide the turtle; make it invisible. Long name for ht(). Both spellings need to provided for compatibility.

See Also:
ht(), showturtle(), st()

home

public void home()
Move the turtle to the center of the display. If the pen is in the DOWN position, a line is drawn. Home is equivilent to setxy( 0, 0 )

See Also:
setxy(double, double)

ht

public void ht()
Hide the turtle; make it invisible. Abbreviation for hideturtle(). Both spellings need to provided for compatibility.

See Also:
hideturtle(), showturtle(), st()

ispendown

public boolean ispendown()
Return the current status of the pen. Return true if the turtle's pen is down or false if it in the up position.

See Also:
pendown(), penup(), pd(), pu()

keypressed

public void keypressed(int keyNum)
Deprecated. 

Empty method declaration which child programs override to process keyboard key events.

Parameters:
keyNum - Character on the keyboard that was pressed while the graphics canvas has its focus.
See Also:
tgKeyPressed(int), tgKeyReleased(int), tgKeyTyped(char)

label

public void label(java.lang.String text)
Draws a String of characters on the graphics canvas. The text is drawn in the current pen's color, starting at the current position of the turtle. The text is always drawn in the standard horizontal manner, i.e., the heading of the turtle is ignored.

Parameters:
text - characters to be drawn on the graphics canvas
See Also:
labelwidth(java.lang.String), setlabelfont(int), setlabelheight(int)

left

public void left(double degrees)
Rotate the turtle counterclockwise by the specified angle, measured in degrees.

Parameters:
degrees - angle to rotate the turtle's heading
See Also:
lt(double)

left

public void left(int degrees)
Rotate the turtle counterclockwise by the specified angle, measured in degrees.

Parameters:
degrees - angle to rotate the turtle's heading
See Also:
lt(double)

loadpicture

public boolean loadpicture(java.lang.String fileName)
Draw a picture from a file onto the background of the graphics canvas. Returns true if successful, otherwise false.

Parameters:
fileName - String that identifies the source image file
See Also:
clean()

loadshape

public boolean loadshape(java.lang.String fileName,
                         int shapeNum)
Load an image file; it can then be used for a turtle's shape, its image. Returns true if successful, otherwise false.

Parameters:
fileName - String that identifies the source image file
shapeNum - an integer that is between FIRST_USER_SUPPLIED_SHAPE and LAST_USER_SUPPLIED_SHAPE, inclusive This number can then be used with setshape() to change the turtle's appearance
See Also:
setshape(int)

lt

public void lt(double degrees)
Rotate the turtle counterclockwise by the specified angle, measured in degrees. Abbreviation for left(). Both spellings need to provided for compatibility.

Parameters:
degrees - Angle to change turtle's heading by.
See Also:
left(double)

lt

public void lt(int degrees)
Rotate the turtle counterclockwise by the specified angle, measured in degrees. Abbreviation for left(). Both spellings need to provided for compatibility.

Parameters:
degrees - Angle to change turtle's heading by.
See Also:
left(double)

mousex

public int mousex()
Return the x-coordinate where the mouse was last moved or clicked within the graphics canvas.

See Also:
mousey(), tgMouseClicked(int, int), tgMouseMoved(int, int)

mousey

public int mousey()
Return the Y-coordinate where the mouse was last moved or clicked within the graphics canvas.

See Also:
mousex(), tgMouseClicked(int, int), tgMouseMoved(int, int)

pd

public void pd()
Lower the turtle's pen into the down position. When the turtle moves, it will leave a trace from its current position to its destination (its new position).

See Also:
ispendown(), pendown(), pu(), penup()

pencolor

public int pencolor()
Return the color the pen is currently drawing in.

See Also:
setpc(int), setpencolor(int)

pendown

public void pendown()
Lower the turtle's pen into the down position. When the turtle moves, it will leave a trace from its current position to its destination (its new position).

See Also:
ispendown(), pd(), penup(), pu()

penup

public void penup()
Lift the turtle's pen into the up position. When the turtle moves, it will leave no trace.

See Also:
ispendown(), pd(), pendown(), pu()

pos

public TGPoint pos()
Return the current position of this turtle.

Returns:
TGPoint a virtual point, a point in TurtleSpace. In TurtleSpace, 0.0,0.0 is at the center of the graphics canvas.

pu

public void pu()
Lift the turtle's pen into the up position. When the turtle moves, it will leave no trace.

See Also:
ispendown(), pd(), pendown(), penup()

right

public void right(double degrees)
Rotate the turtle clockwise by the specified angle, measured in degrees.

Parameters:
degrees - angle to rotate the turtle's heading
See Also:
rt(double)

right

public void right(int degrees)
Rotate the turtle clockwise by the specified angle, measured in degrees.

Parameters:
degrees - angle to rotate the turtle's heading
See Also:
rt(double)

rt

public void rt(double degrees)
Rotate the turtle clockwise by the specified angle, measured in degrees. Abbreviation for right(). Both spellings need to provided for compatibility.

Parameters:
degrees - angle to rotate the turtle's heading
See Also:
right(double)

rt

public void rt(int degrees)
Rotate the turtle clockwise by the specified angle, measured in degrees. Abbreviation for right(). Both spellings need to provided for compatibility.

Parameters:
degrees - angle to rotate the turtle's heading
See Also:
right(double)

setbg

public void setbg(int logoColor)
Set the background color of the graphics canvas.

*NOTE* a side-effect of changing the background color is that all current graphics is cleared.

 Number Color        Number Color        Number Color
 ------ ----------   ------ ----------   ------ ---------
    0   black          11   aqua           22   gold
    1   blue           12   salmon         23   lightgray
    2   green          13   purple         24   peru
    3   cyan           14   orange         25   wheat
    4   red            15   grey           26   palegreen
    5   magenta        16   navy           27   lightblue
    6   yellow         17   skyblue        28   khaki
    7   white          18   lime           29   pink
    8   brown          19   steelblue      30   lawngreen
    9   light brown    20   chocolate      31   olive
   10   forest         21   purple
 

Color numbers greater than 31 will be treated as RGB values. Assuming bits are numbered 0-31, left to right, the red component is in bits 8-15, the green component in bits 16-23, and the blue component in bits 24-31. The actual color used in rendering will depend on finding the best match given the color space available for a given display.

See Also:
clean(), loadpicture(java.lang.String), setpencolor(int), BLACK, BLUE, AQUA, BROWN, CHOCOLATE, CYAN, GOLD, FOREST, GRAY, GREEN, KHAKI, LAWNGREEN, LIGHTBLUE, LIGHTGRAY, LIME, MAGENTA, NAVY, OLIVE, ORANGE, PALEGREEN, PERU, PINK, PURPLE, RED, SALMON, SKYBLUE, STEELBLUE, TAN, VIOLET, WHEAT, WHITE, YELLOW

seth

public void seth(double degrees)
Turns the turtle to the specified absolute heading. The heading is specified in degrees (units of 1/360th of a circle) with 0 being North (+Y axis), increasing clockwise. So, East is 90 degrees, South is 180 degrees, and West is 270 degrees. Abbreviation for setheading(). Both spellings need to provided for compatibility.

Parameters:
degrees - number of 1/360ths increments clockwise from the positive Y axis
See Also:
setheading(double)

seth

public void seth(int degrees)
Turns the turtle to the specified absolute heading. The heading is specified in degrees (units of 1/360th of a circle) with 0 being North (+Y axis), increasing clockwise. So, East is 90 degrees, South is 180 degrees, and West is 270 degrees. Abbreviation for setheading(). Both spellings need to provided for compatibility.

Parameters:
degrees - number of 1/360ths increments clockwise from the positive Y axis
See Also:
setheading(double)

setheading

public void setheading(double degrees)
Turns the turtle to the specified absolute heading. The heading is specified in degrees (units of 1/360th of a circle) with 0 being North (+Y axis), increasing clockwise. So, East is 90 degrees, South is 180 degrees, and West is 270 degrees.

Parameters:
degrees - number of 1/360ths increments clockwise from the positive Y axis
See Also:
seth(double)

setheading

public void setheading(int degrees)
Turns the turtle to the specified absolute heading. The heading is specified in degrees (units of 1/360th of a circle) with 0 being North (+Y axis), increasing clockwise. So, East is 90 degrees, South is 180 degrees, and West is 270 degrees.

Parameters:
degrees - number of 1/360ths increments clockwise from the positive Y axis
See Also:
seth(double)

setlabelfont

public void setlabelfont(int fontNumber)
                  throws java.lang.IllegalArgumentException
Set the font for LABELs, text drawn on the graphics canvas by the turtle.

Parameters:
fontNumber - an integer representing a font face and font style

 Number   Font         Style
 ------   ----------   -----------
    0     Courier      Plain
    1     Courier      Bold
    2     Courier      Italic
    3     Courier      Bold Italic
    4     Sans Serif   Plain
    5     Sans Serif   Bold
    6     Sans Serif   Italic
    7     Sans Serif   Bold Italic
    8     Serif        Plain
    9     Serif        Bold
   10     Serif        Italic
   11     Serif        Bold Italic
 
Throws:
java.lang.IllegalArgumentException
See Also:
label(java.lang.String), labelwidth(java.lang.String), setlabelheight(int), COURIER, COURIER_BOLD, COURIER_ITALIC, COURIER_BOLD_ITALIC, SANS_SERIF, SANS_SERIF_BOLD, SANS_SERIF_ITALIC, SANS_SERIF_BOLD_ITALIC, SERIF, SERIF_BOLD, SERIF_ITALIC, SERIF_BOLD_ITALIC

setlabelheight

public void setlabelheight(int size)
                    throws java.lang.IllegalArgumentException
Set the height of the text drawn on the graphics canvas with the label() method.

Parameters:
size - approximate number of pixels tall the uppercase characters should be (in the current font/style)
Throws:
java.lang.IllegalArgumentException
See Also:
label(java.lang.String), setlabelfont(int), labelwidth(java.lang.String)

setlinecap

public void setlinecap(int typeLinecap)
                throws java.lang.IllegalArgumentException
Set the type of linecaps applied to the ends of lines drawn. Linecap Description -------------- ---------------------------------------------------- LINECAP_BUTT - lines start/end where turtle starts and stops. This is the default linecap. LINECAP_ROUND - line ends are rounded with a semicircle extending a half pensize before/after turtle starts and stops. LINECAP_SQUARE - line ends are extended a half pensize before/after turtle starts and stops.

Parameters:
typeLinecap - an integer representing the desired linecap.
Throws:
java.lang.IllegalArgumentException

setpc

public void setpc(int colorNum)
Sets the color of the turtle's pen to the supplied number.

Parameters:
colorNum - either a built-in Logo color number in the range 0-31, else a 24-bit RGB color value

 Number Color        Number Color        Number Color
 ------ ----------   ------ ----------   ------ ---------
    0   black          11   aqua           22   gold
    1   blue           12   salmon         23   lightgray
    2   green          13   purple         24   peru
    3   cyan           14   orange         25   wheat
    4   red            15   grey           26   palegreen
    5   magenta        16   navy           27   lightblue
    6   yellow         17   skyblue        28   khaki
    7   white          18   lime           29   pink
    8   brown          19   steelblue      30   lawngreen
    9   light brown    20   chocolate      31   olive
   10   forest         21   purple
 

Color numbers greater than 31 will be treated as RGB values. Assuming bits are numbered 0-31, left to right, the red component is in bits 8-15, the green component in bits 16-23, and the blue component in bits 24-31. The actual color used in rendering will depend on finding the best match given the color space available for a given display.

See Also:
setbg(int), setpencolor(int), BLACK, BLUE, AQUA, BROWN, CHOCOLATE, CYAN, GOLD, FOREST, GRAY, GREEN, KHAKI, LAWNGREEN, LIGHTBLUE, LIGHTGRAY, LIME, MAGENTA, NAVY, OLIVE, ORANGE, PALEGREEN, PERU, PINK, PURPLE, RED, SALMON, SKYBLUE, STEELBLUE, TAN, VIOLET, WHEAT, WHITE, YELLOW

setpencolor

public void setpencolor(int colorNum)
Sets the color of the turtle's pen to the supplied number.

Parameters:
colorNum - either a built-in Logo color number in the range 0-31, else a 24-bit RGB color value

 Number Color        Number Color        Number Color
 ------ ----------   ------ ----------   ------ ---------
    0   black          11   aqua           22   gold
    1   blue           12   salmon         23   lightgray
    2   green          13   purple         24   peru
    3   cyan           14   orange         25   wheat
    4   red            15   grey           26   palegreen
    5   magenta        16   navy           27   lightblue
    6   yellow         17   skyblue        28   khaki
    7   white          18   lime           29   pink
    8   brown          19   steelblue      30   lawngreen
    9   light brown    20   chocolate      31   olive
   10   forest         21   purple
 

Color numbers greater than 31 will be treated as RGB values. Assuming bits are numbered 0-31, left to right, the red component is in bits 8-15, the green component in bits 16-23, and the blue component in bits 24-31. The actual color used in rendering will depend on finding the best match given the color space available for a given display.

See Also:
setbg(int), setpc(int), BLACK, BLUE, AQUA, BROWN, CHOCOLATE, CYAN, GOLD, FOREST, GRAY, GREEN, KHAKI, LAWNGREEN, LIGHTBLUE, LIGHTGRAY, LIME, MAGENTA, NAVY, OLIVE, ORANGE, PALEGREEN, PERU, PINK, PURPLE, RED, SALMON, SKYBLUE, STEELBLUE, TAN, VIOLET, WHEAT, WHITE, YELLOW

setpenpattern

public void setpenpattern(int segmentSize)
                   throws java.lang.IllegalArgumentException
Set the pattern used to draw lines. A pattern consists of lengths of down and up pen states when drawing lines. If segmentSize is zero, solid lines are drawn. Otherwise, it is used as the distance draw followed by the distance to skip over.

Parameters:
segmentSize - draw/skip amount.
Throws:
java.lang.IllegalArgumentException
See Also:
back(double), bk(double), fd(double), forward(double), home(), setx(double), setxy(double, double), sety(double)

setpenpattern

public void setpenpattern(int[] pattern)
                   throws java.lang.IllegalArgumentException
Set the pattern used to draw lines. A pattern consists of lengths of down and up pen states when drawing lines. If the pattern is null or empty, solid lines are drawn. Otherwise, the array's even elements are distances to draw and the odd elements are distances to skip over.

Parameters:
pattern - array of draw/skip amounts. If pattern has an odd number of elements, the last draw amount is duplicated for the skip amount, producing a pattern one element longer.
Throws:
java.lang.IllegalArgumentException

setpensize

public void setpensize(int width)
Sets the width of the turtle's pen to the supplied number.

Parameters:
width - small positive number; 1 (or less) results in a single pixel line. greater numbers result in line widths equal to width pixels.

setpos

public void setpos(TGPoint pos)
Move the turtle to an absolute display position, to the x and y coordinates in the TGPoint parameter.

Parameters:
pos - a TGPoint object containing the X-coordinate and Y-coordinate of destination
See Also:
home(), setx(double), setxy(double, double), sety(double)

setshape

public boolean setshape(int shapeNum)
Sets the shape of the turtle - its pixel image. Returns true if shape successfully set, else false failure.

Parameters:
shapeNum - small positive number for either a built-in shape (see constants (e.g., BALL, BOX, etc...) or a user-supplied image via loadShape() method
 Number  Shape
 ------  --------
    0    Turtle
    1    Arrow
    2    Ball
    3    Box
    4    Cross
    5    Triangle
    6    Diamond
 
See Also:
loadshape(java.lang.String, int), stamp(), ARROW, BALL, BOX, CROSS, DIAMOND, TRIANGLE,

setshape

public boolean setshape(int shapeNum,
                        int[] params)
Sets the shape of the turtle - its pixel image. Returns true if shape successfully set, else false for failure.

Parameters:
shapeNum - small positive number; 0 for default turtle image; see constants (e.g., BALL, BOX, etc...) for other turtle shapes
params - an optional int array containing sizing information hints, e.g. radius of a ball, width and height of a box, etc...

 Number  Shape      Optional Size Parameters
 ------  --------   ------------------------
    0    Turtle
    1    Arrow      width, height
    2    Ball       diameter
    3    Box        width, height
    4    Cross      width, height
    5    Triangle   width, height
    6    Diamond    width, height
 
See Also:
loadshape(java.lang.String, int), stamp(), ARROW, BALL, BOX, CROSS, DIAMOND, TRIANGLE, TURTLE

setshape

public void setshape(SpritePixels newSpritePixels)
Sets the shape of the turtle - its pixel image.

Parameters:
newSpritePixels -

See Also:
loadshape(java.lang.String, int)

setx

public void setx(double newX)
Move the turtle to an absolute display position. Move the turtle horizontally to a new location specified as an X coordinate argument.

Parameters:
newX - the X-coordinate of destination
See Also:
home(), setxy(double, double), sety(double)

setx

public void setx(int newX)
Move the turtle to an absolute display position. Move the turtle horizontally to a new location specified as an X coordinate argument.

Parameters:
newX - the X-coordinate of destination
See Also:
home(), setxy(double, double), sety(double)

setxy

public void setxy(double newX,
                  double newY)
Move the turtle to an absolute display position. Move the turtle to the x and y coordinates provided as arguments.

Parameters:
newX - the X-coordinate of destination
newY - the Y-coordinate of destination
See Also:
home(), setx(double), sety(double)

setxy

public void setxy(int newX,
                  int newY)
Move the turtle to an absolute display position. Move the turtle to the x and y coordinates provided as arguments.

Parameters:
newX - the X-coordinate of destination
newY - the Y-coordinate of destination
See Also:
home(), setx(double), sety(double)

setxy

public void setxy(TGPoint newPt)
Move the turtle to an absolute display position. Move the turtle to the x and y coordinates provided in the TGPoint parameter.

Parameters:
newPt - a TGPoint objext containing the X-coordinate and Y-coordinate of destination
See Also:
home(), setx(double), sety(double)

sety

public void sety(double newY)
Move the turtle to an absolute display position. Move the turtle vertically to a new location specified as an Y coordinate argument.

Parameters:
newY - the Y-coordinate of destination
See Also:
home(), setx(double), setxy(double, double)

sety

public void sety(int newY)
Move the turtle to an absolute display position. Move the turtle vertically to a new location specified as an Y coordinate argument.

Parameters:
newY - the Y-coordinate of destination
See Also:
home(), setx(double), setxy(double, double)

shapeheight

public int shapeheight()
Return the height of the image of the turtle, as it appears for its current heading.

See Also:
setshape(int), setshape(int, int[])

shapewidth

public int shapewidth()
Return the width of the image of the turtle, as it appears for its current heading.

See Also:
setshape(int), setshape(int, int[])

shownp

public boolean shownp()
Return true if this turtle's image is being displayed on the graphics canvas, else return false.

See Also:
hideturtle(), ht(), showturtle(), st()

showturtle

public void showturtle()
Show the turtle; make it visible. Long name for st(). Both spellings need to provided for compatibility.

See Also:
hideturtle(), ht(), st()

st

public void st()
Show the turtle; make it visible. Abbreviation for showturtle(). Both spellings need to provided for compatibility.

See Also:
hideturtle(), ht(), showturtle()

stamp

public void stamp()
Draw the turtle's image onto the graphics canvas.

See Also:
setshape(int), setshape(int, int[])

throttle

public void throttle(int amt)
Set the amount of time (milliseconds) that drawing is suspended each time a method which visibly changes the turtle's state is performed. To aid debugging and/or optimizing a grapical program it can be helpful to artificially slow down the drawing. When throttleSleepAmt is greater than zero, concerned methods suspend the current Thread for it's amount.

Parameters:
amt - - milliseconds to pause after the visible state of the turtle changes. When less than or equal to zero, pausing is turned off.

xcor

public int xcor()
Return the turtle's X-coordinate

See Also:
setxy(double, double), setx(double), sety(double), ycor()

ycor

public int ycor()
Return the turtle's Y-coordinate

See Also:
setxy(double, double), setx(double), sety(double), xcor()