Class Turtle

    • Constructor Summary

      Constructors 
      Constructor Description
      Turtle()
      Makes a turtle at the center of the canvas at location (0, 0).
      Turtle​(double x, double y)
      Makes a turtle at the specified position.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void accessiblePrinting​(boolean printToConsole)
      Turn accessible printing on or off.
      void actionPerformed​(java.awt.event.ActionEvent e)
      Internal mehod for handling events.
      static void backgroundMode​(int mode)
      This specifies how the background is drawn.
      long backward​(double distance)
      Moves the turtle backward by the given distance.
      static void bgcolor​(java.awt.Color color)
      Sets the background color.
      static void bgcolor​(java.lang.String color)
      Sets the background color.
      static void bgpic​(java.lang.String filename)
      Set the background image.
      static double canvasX​(double screenX)
      Converts screen coordinates to canvas coordinates.
      static double canvasY​(double screenY)
      Converts screen coordinates to canvas coordinates.
      void clear()
      Clears all the drawing that a turtle has done but all the turtle settings remain the same.
      Turtle clone()
      This creates a cloned copy of a turtle.
      void componentHidden​(java.awt.event.ComponentEvent e)
      Internal mehod for handling events.
      void componentMoved​(java.awt.event.ComponentEvent e)
      Internal mehod for handling events.
      void componentResized​(java.awt.event.ComponentEvent e)
      Internal mehod for handling events.
      void componentShown​(java.awt.event.ComponentEvent e)
      Internal mehod for handling events.
      boolean contains​(int x, int y)
      Determines if a turtle is covering a screen position
      double distance​(double x, double y)
      Gets the distance to another position.
      long dot()
      Put a dot 3 times the size of the penWidth on the canvas.
      long dot​(java.awt.Color color)
      Put a dot 3 times the size of the penWidth on the canvas.
      long dot​(java.awt.Color color, double dotSize)
      Put a dot on the canvas.
      long dot​(java.lang.String color)
      Put a dot 3 times the size of the penWidth on the canvas.
      long dot​(java.lang.String color, double dotSize)
      Put a dot on the canvas.
      long down()
      Puts the turtle's pen down so it will draw on the screen as it moves.
      static void draw()  
      static void exit()  
      long face​(double x, double y)
      Sets the direction in such a way that it faces (x,y)
      long fillColor​(java.awt.Color fillColor)
      Sets the turtle's fill color.
      long fillColor​(java.lang.String fillColor)
      Sets the turtle's fill color.
      long forward​(double distance)
      Moves the turtle forward by the given distance.
      double getDirection()
      Gets the direction the turtle is facing neglecting tilt.
      double getSpeed()
      Gets the speed of the animation.
      double getTilt()
      Gets the rotation of the turtle's shape away from the turtle's direction.
      double getX()
      Gets the x coordinate of the turtle.
      double getY()
      Gets the y coordinate of the turtle.
      long hide()
      Hides the turtle but it can still draw.
      long home()
      Moves the turtle to (0,0) and facing east.
      static boolean isKeyDown​(java.lang.String key)
      Test if a key is pressed or not.
      void keyPressed​(java.awt.event.KeyEvent e)
      Internal mehod for handling events.
      void keyReleased​(java.awt.event.KeyEvent e)
      Internal mehod for handling events.
      static java.lang.String[] keysDown()
      Get the pressed keys.
      void keyTyped​(java.awt.event.KeyEvent e)
      Internal mehod for handling events.
      long left​(double angle)
      Turns the turtle left by the number of indicated degrees.
      static void main​(java.lang.String[] a)
      Demo program
      static boolean mouseButton()
      Check to see if a mouse button is down.
      static boolean mouseButton1()
      Check to see if the first mouse button is down.
      static boolean mouseButton2()
      Check to see if the second mouse button is down.
      static boolean mouseButton3()
      Check to see if the third mouse button is down.
      void mouseClicked​(java.awt.event.MouseEvent e)
      Internal mehod for handling events.
      void mouseDragged​(java.awt.event.MouseEvent e)
      Internal mehod for handling events.
      void mouseEntered​(java.awt.event.MouseEvent e)
      Internal mehod for handling events.
      void mouseExited​(java.awt.event.MouseEvent e)
      Internal mehod for handling events.
      void mouseMoved​(java.awt.event.MouseEvent e)
      Internal mehod for handling events.
      void mousePressed​(java.awt.event.MouseEvent e)
      Internal mehod for handling events.
      void mouseReleased​(java.awt.event.MouseEvent e)
      Internal mehod for handling events.
      void mouseWheelMoved​(java.awt.event.MouseWheelEvent e)
      Internal mehod for handling events.
      static int mouseX()
      Get the mouse x coordinate using the screens coordinate system.
      static int mouseY()
      Get the mouse y coordinate using the screens coordinate system.
      boolean onKey​(java.lang.String methodName, java.lang.String keyText)
      Links a method to a key.
      boolean onKey​(java.lang.String methodName, java.lang.String keyText, boolean append)
      Links a method to a key.
      boolean onKey​(java.lang.String methodName, java.lang.String keyText, boolean append, boolean repeat)
      Links a method to a key.
      long outlineColor​(java.awt.Color outlineColor)
      Sets the turtle's outlineColor color.
      long outlineColor​(java.lang.String outlineColor)
      Sets the turtle's outlineColor color.
      long outlineWidth​(double width)
      Sets the width of the turtle's outline.
      long penColor​(java.awt.Color penColor)
      Sets the turtle's path color.
      long penColor​(java.lang.String penColor)
      Sets the turtle's path color.
      void redo()
      Redo turtle state changes.
      void redo​(int steps)
      Redo turtle state changes.
      static void refreshMode​(int mode)
      This specifies when the screen gets refreshed.
      long right​(double angle)
      Turns the turtle right by the number of indicated degrees.
      void run()
      This is an internal method that should never be called.
      static void save​(java.lang.String filename)
      Saves the visible canvas to an image.
      static double screenX​(double canvasX)  
      static double screenY​(double canvasY)  
      static void setCanvasSize​(int width, int height)
      Changes the size of the canvas effectively changing the size of the window.
      long setDirection​(double direction)
      Sets the direction the turtle is facing neglecting tilt.
      long setPosition​(double x, double y)
      Sets the position of a turtle.
      long setPosition​(double x, double y, double direction)
      Sets the position and direction of a turtle.
      long setTilt​(double angle)
      Sets the angle to rotate the turtle's shape when rendering.
      long shape​(java.lang.String shape)
      Sets the shape of the turtle using the built in shapes (turtle,square, rectangle,triangle,arrow,circle) or to a image.
      long shapeSize​(int width, int height)  
      long show()
      Makes the turtle visible.
      long speed​(double delay)
      Sets the speed of the animation.
      long stab()  
      long stamp()
      Put a copy of the current turtle shape on the canvas.
      static void startApplet​(javax.swing.JApplet applet)
      This is an experimental method that should allow you to make turtle applets in the future.
      long tilt​(double angle)
      Adds an additional angle to rotation of the turtle's shape when rendering.
      double towards​(double x, double y)
      Gets direction towards (x,y)
      void undo()
      Undo the last turtle state change.
      void undo​(int steps)
      Undo turtle state changes.
      long up()
      Picks the turtle's pen up so it won't draw on the screen as it moves.
      static void update()
      Force redraw when the refreshMode is set to on demand.
      long width​(double penWidth)
      Sets the width of the turtle's pen.
      long write​(java.lang.String text, java.lang.String fontName, int fontSize, int justification, double xOffset, double yOffset)  
      static void zoom​(double minx, double miny, double maxx, double maxy)
      Fits the indicated box in the center of the screen as large as possible.
      static void zoomFit()
      Fits everything on the screen.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Turtle

        public Turtle()
        Makes a turtle at the center of the canvas at location (0, 0).
         Turtle t = new Turtle();
         
      • Turtle

        public Turtle​(double x,
                      double y)
        Makes a turtle at the specified position.
        Parameters:
        x - x coordinate
        y - y coordinate
    • Method Detail

      • run

        public void run()
        This is an internal method that should never be called.
        Specified by:
        run in interface java.lang.Runnable
      • accessiblePrinting

        public static void accessiblePrinting​(boolean printToConsole)
        Turn accessible printing on or off. When accessible printing is turned on, every turtle command that could result in a visual graphical upate will also be printed to the console as text.
        Parameters:
        printToConsole - true to turn on accessible printing, or false to turn off accessible printing
      • exit

        public static void exit()
      • startApplet

        public static void startApplet​(javax.swing.JApplet applet)
        This is an experimental method that should allow you to make turtle applets in the future. For now, it doesn't work because the key and mouse bindings require reflection and applets think that allowing reflection would open a security hole. Theoretically in the init method of the applet you need to place Turtle.startApplet(this);. This is not currently working.
        Parameters:
        applet - applet
      • clone

        public Turtle clone()
        This creates a cloned copy of a turtle.
        Overrides:
        clone in class java.lang.Object
        Returns:
        a cloned copy of a turtle
      • contains

        public boolean contains​(int x,
                                int y)
        Determines if a turtle is covering a screen position
        Parameters:
        x - x screen coordinate
        y - y screen coordinate
        Returns:
        true if this turtle is at the indicated screen position.
      • getSpeed

        public double getSpeed()
        Gets the speed of the animation.
        Returns:
        milliseconds it takes to do one action
      • speed

        public long speed​(double delay)
        Sets the speed of the animation.
         Turtle t = new Turtle();
         t.speed(1000);
         t.forward(100); // takes 1000 ms (1 second) to move forward 100 units
         t.forward(5); // takes 1000 ms (1 second) to move forward 5 units
         t.speed(100);
         t.left(90); // takes 100 ms (0.1 second) to turn left 90 degrees
         
        Parameters:
        delay - milliseconds it takes to do one action
        Returns:
        state change timestamp
      • forward

        public long forward​(double distance)
        Moves the turtle forward by the given distance. Each unit of distance is one pixel at the default zoom level.

        The example below constructs a turtle and moves it forward. If the canvas is zoomed to the default zoom level, then the distance moved is 50 pixels.

         Turtle t = new Turtle();
         t.forward(50);
         
        Parameters:
        distance - number of units to move forward
        Returns:
        state change timestamp
      • backward

        public long backward​(double distance)
        Moves the turtle backward by the given distance. Each unit of distance is one pixel at the default zoom level.
        Parameters:
        distance - number of units to move forward
        Returns:
        state change timestamp
      • left

        public long left​(double angle)
        Turns the turtle left by the number of indicated degrees.
        Parameters:
        angle - angle in degrees
        Returns:
        state change timestamp
      • right

        public long right​(double angle)
        Turns the turtle right by the number of indicated degrees.
        Parameters:
        angle - angle in degrees
        Returns:
        state change timestamp
      • getDirection

        public double getDirection()
        Gets the direction the turtle is facing neglecting tilt.
        Returns:
        state change timestamp
      • setDirection

        public long setDirection​(double direction)
        Sets the direction the turtle is facing neglecting tilt.
        Parameters:
        direction - angle counter-clockwise from east
        Returns:
        state change timestamp
      • home

        public long home()
        Moves the turtle to (0,0) and facing east.
        Returns:
        state change timestamp
      • hide

        public long hide()
        Hides the turtle but it can still draw.
        Returns:
        state change timestamp
      • show

        public long show()
        Makes the turtle visible.
        Returns:
        state change timestamp
      • face

        public long face​(double x,
                         double y)
        Sets the direction in such a way that it faces (x,y)
        Parameters:
        x - x coordinate of target location
        y - y coordinate of target location
        Returns:
        state change timestamp
      • towards

        public double towards​(double x,
                              double y)
        Gets direction towards (x,y)
        Parameters:
        x - x coordinate of target location
        y - y coordinate of target location
        Returns:
        angle in degrees where 0 <= angle <
      • distance

        public double distance​(double x,
                               double y)
        Gets the distance to another position.
        Parameters:
        x - x coordinate of target location
        y - y coordinate of target location
        Returns:
        distance between turtle's current location and another position
      • getX

        public double getX()
        Gets the x coordinate of the turtle.
        Returns:
        x coordinate
      • getY

        public double getY()
        Gets the y coordinate of the turtle.
        Returns:
        y coordinate
      • setPosition

        public long setPosition​(double x,
                                double y,
                                double direction)
        Sets the position and direction of a turtle.
        Parameters:
        x - x coordinate
        y - y coordinate
        direction - angle counter-clockwise from east in degrees
        Returns:
        state change timestamp
      • setPosition

        public long setPosition​(double x,
                                double y)
        Sets the position of a turtle.
        Parameters:
        x - x coordinate
        y - y coordinate
        Returns:
        state change timestamp
      • tilt

        public long tilt​(double angle)
        Adds an additional angle to rotation of the turtle's shape when rendering. This is useful when you need to face a different direction than the direction you are moving in.
        Parameters:
        angle - angle in degrees
        Returns:
        state change timestamp
      • setTilt

        public long setTilt​(double angle)
        Sets the angle to rotate the turtle's shape when rendering. This is useful when you need to face a different direction than the direction you are moving in.
        Parameters:
        angle - angle in degrees
        Returns:
        state change timestamp
      • getTilt

        public double getTilt()
        Gets the rotation of the turtle's shape away from the turtle's direction.
        Returns:
        tilt in degrees (positive in counter-clockwise)
      • width

        public long width​(double penWidth)
        Sets the width of the turtle's pen. Each unit of width corresponds to 1 pixel at the default zoom level.
        Parameters:
        penWidth - number of units wide
        Returns:
        state change timestamp
      • outlineWidth

        public long outlineWidth​(double width)
        Sets the width of the turtle's outline.
        Parameters:
        width - width of the turtle's outline
        Returns:
        state change timestamp
      • up

        public long up()
        Picks the turtle's pen up so it won't draw on the screen as it moves.
        Returns:
        state change timestamp
      • down

        public long down()
        Puts the turtle's pen down so it will draw on the screen as it moves.
        Returns:
        state change timestamp
      • stab

        public long stab()
      • penColor

        public long penColor​(java.lang.String penColor)
        Sets the turtle's path color.
        Parameters:
        penColor - Color of the turtle's path.
        Returns:
        state change timestamp
      • penColor

        public long penColor​(java.awt.Color penColor)
        Sets the turtle's path color.
        Parameters:
        penColor - Color of the turtle's path.
        Returns:
        state change timestamp
      • outlineColor

        public long outlineColor​(java.lang.String outlineColor)
        Sets the turtle's outlineColor color.
        Parameters:
        outlineColor - Color of the turtle's outlineColor.
        Returns:
        state change timestamp
      • outlineColor

        public long outlineColor​(java.awt.Color outlineColor)
        Sets the turtle's outlineColor color.
        Parameters:
        outlineColor - Color of the turtle's outlineColor.
        Returns:
        state change timestamp
      • fillColor

        public long fillColor​(java.lang.String fillColor)
        Sets the turtle's fill color.
        Parameters:
        fillColor - Color of the turtle's fill.
        Returns:
        state change timestamp
      • fillColor

        public long fillColor​(java.awt.Color fillColor)
        Sets the turtle's fill color.
        Parameters:
        fillColor - Color of the turtle's fill.
        Returns:
        state change timestamp
      • shape

        public long shape​(java.lang.String shape)
        Sets the shape of the turtle using the built in shapes (turtle,square, rectangle,triangle,arrow,circle) or to a image.
        Parameters:
        shape - shapename or filename of image
        Returns:
        state change timestamp
      • shapeSize

        public long shapeSize​(int width,
                              int height)
      • stamp

        public long stamp()
        Put a copy of the current turtle shape on the canvas.
        Returns:
        state change timestamp
      • dot

        public long dot()
        Put a dot 3 times the size of the penWidth on the canvas.
        Returns:
        state change timestamp
      • dot

        public long dot​(java.lang.String color)
        Put a dot 3 times the size of the penWidth on the canvas.
        Parameters:
        color - color of dot
        Returns:
        state change timestamp
      • dot

        public long dot​(java.awt.Color color)
        Put a dot 3 times the size of the penWidth on the canvas.
        Parameters:
        color - color of dot
        Returns:
        state change timestamp
      • dot

        public long dot​(java.lang.String color,
                        double dotSize)
        Put a dot on the canvas.
        Parameters:
        color - color of dot
        dotSize - diameter of the dot
        Returns:
        state change timestamp
      • dot

        public long dot​(java.awt.Color color,
                        double dotSize)
        Put a dot on the canvas.
        Parameters:
        color - color of dot
        dotSize - diameter of the dot
        Returns:
        state change timestamp
      • write

        public long write​(java.lang.String text,
                          java.lang.String fontName,
                          int fontSize,
                          int justification,
                          double xOffset,
                          double yOffset)
      • undo

        public void undo​(int steps)
        Undo turtle state changes.
        Parameters:
        steps - the number of state changes to remove
      • undo

        public void undo()
        Undo the last turtle state change.
      • redo

        public void redo​(int steps)
        Redo turtle state changes.
        Parameters:
        steps - the number of state changes to restore
      • redo

        public void redo()
        Redo turtle state changes.
      • clear

        public void clear()
        Clears all the drawing that a turtle has done but all the turtle settings remain the same. (color, location, direction, shape)
      • refreshMode

        public static void refreshMode​(int mode)
        This specifies when the screen gets refreshed. 0(default)=Animated (The turtle will slide from one state to another without being jerky.) 1=State Change (The turtle will refresh immediately to the last state. Jerky motion.) 2=On Demand (The turtle will refresh only when you call update())
        Parameters:
        mode - refresh mode
      • backgroundMode

        public static void backgroundMode​(int mode)
        This specifies how the background is drawn. 0=The image if present is stretched to fill the screen. 1=The image is centered on the middle of the screen and will not scale/pan 2=The image is tiled and will not scale/pan 3=The image is centered on (0,0) and will scale/pan 4(default)=The image is tiled and will scale/pan
        Parameters:
        mode - background mode
      • bgcolor

        public static void bgcolor​(java.lang.String color)
        Sets the background color.
        Parameters:
        color - Color of the background.
      • bgcolor

        public static void bgcolor​(java.awt.Color color)
        Sets the background color.
        Parameters:
        color - Color of the background.
      • bgpic

        public static void bgpic​(java.lang.String filename)
        Set the background image.
        Parameters:
        filename - filename for a background image
      • onKey

        public boolean onKey​(java.lang.String methodName,
                             java.lang.String keyText)
        Links a method to a key.
        Parameters:
        methodName - method to be executed when the key is pressed
        keyText - key that triggers the method
        Returns:
        boolean
      • onKey

        public boolean onKey​(java.lang.String methodName,
                             java.lang.String keyText,
                             boolean append)
        Links a method to a key.
        Parameters:
        methodName - method to be executed when the key is pressed
        keyText - key that triggers the method
        append - true if you want to have multiple methods per key
        Returns:
        boolean
      • onKey

        public boolean onKey​(java.lang.String methodName,
                             java.lang.String keyText,
                             boolean append,
                             boolean repeat)
        Links a method to a key.
        Parameters:
        methodName - method to be executed when the key is pressed
        keyText - key that triggers the method
        append - true if you want to have multiple methods per key
        repeat - true if you want call the method every screen refresh
        Returns:
        boolean
      • zoom

        public static void zoom​(double minx,
                                double miny,
                                double maxx,
                                double maxy)
        Fits the indicated box in the center of the screen as large as possible.
        Parameters:
        minx - left x coordinate of box
        miny - bottom y coordinate of box
        maxx - right x coordinate of box
        maxy - top y coordinate of box
      • zoomFit

        public static void zoomFit()
        Fits everything on the screen.
      • update

        public static void update()
        Force redraw when the refreshMode is set to on demand.
      • draw

        public static void draw()
      • setCanvasSize

        public static void setCanvasSize​(int width,
                                         int height)
        Changes the size of the canvas effectively changing the size of the window.
        Parameters:
        width - width of the canvas
        height - height of the canvas
      • save

        public static void save​(java.lang.String filename)
        Saves the visible canvas to an image.
        Parameters:
        filename - image filename
      • main

        public static void main​(java.lang.String[] a)
        Demo program
        Parameters:
        a - commandline args
      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent e)
        Internal mehod for handling events.
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
        Parameters:
        e - event
      • mouseClicked

        public void mouseClicked​(java.awt.event.MouseEvent e)
        Internal mehod for handling events.
        Specified by:
        mouseClicked in interface java.awt.event.MouseListener
        Parameters:
        e - event
      • mouseEntered

        public void mouseEntered​(java.awt.event.MouseEvent e)
        Internal mehod for handling events.
        Specified by:
        mouseEntered in interface java.awt.event.MouseListener
        Parameters:
        e - event
      • mouseExited

        public void mouseExited​(java.awt.event.MouseEvent e)
        Internal mehod for handling events.
        Specified by:
        mouseExited in interface java.awt.event.MouseListener
        Parameters:
        e - event
      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent e)
        Internal mehod for handling events.
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
        Parameters:
        e - event
      • mouseReleased

        public void mouseReleased​(java.awt.event.MouseEvent e)
        Internal mehod for handling events.
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
        Parameters:
        e - event
      • mouseDragged

        public void mouseDragged​(java.awt.event.MouseEvent e)
        Internal mehod for handling events.
        Specified by:
        mouseDragged in interface java.awt.event.MouseMotionListener
        Parameters:
        e - event
      • mouseMoved

        public void mouseMoved​(java.awt.event.MouseEvent e)
        Internal mehod for handling events.
        Specified by:
        mouseMoved in interface java.awt.event.MouseMotionListener
        Parameters:
        e - event
      • keyTyped

        public void keyTyped​(java.awt.event.KeyEvent e)
        Internal mehod for handling events.
        Specified by:
        keyTyped in interface java.awt.event.KeyListener
        Parameters:
        e - event
      • keyPressed

        public void keyPressed​(java.awt.event.KeyEvent e)
        Internal mehod for handling events.
        Specified by:
        keyPressed in interface java.awt.event.KeyListener
        Parameters:
        e - event
      • keyReleased

        public void keyReleased​(java.awt.event.KeyEvent e)
        Internal mehod for handling events.
        Specified by:
        keyReleased in interface java.awt.event.KeyListener
        Parameters:
        e - event
      • componentHidden

        public void componentHidden​(java.awt.event.ComponentEvent e)
        Internal mehod for handling events.
        Specified by:
        componentHidden in interface java.awt.event.ComponentListener
        Parameters:
        e - event
      • componentMoved

        public void componentMoved​(java.awt.event.ComponentEvent e)
        Internal mehod for handling events.
        Specified by:
        componentMoved in interface java.awt.event.ComponentListener
        Parameters:
        e - event
      • componentResized

        public void componentResized​(java.awt.event.ComponentEvent e)
        Internal mehod for handling events.
        Specified by:
        componentResized in interface java.awt.event.ComponentListener
        Parameters:
        e - event
      • componentShown

        public void componentShown​(java.awt.event.ComponentEvent e)
        Internal mehod for handling events.
        Specified by:
        componentShown in interface java.awt.event.ComponentListener
        Parameters:
        e - event
      • mouseWheelMoved

        public void mouseWheelMoved​(java.awt.event.MouseWheelEvent e)
        Internal mehod for handling events.
        Specified by:
        mouseWheelMoved in interface java.awt.event.MouseWheelListener
        Parameters:
        e - event
      • keysDown

        public static java.lang.String[] keysDown()
        Get the pressed keys.
        Returns:
        a list of pressed keys
      • isKeyDown

        public static boolean isKeyDown​(java.lang.String key)
        Test if a key is pressed or not.
        Parameters:
        key - key you are testing
        Returns:
        true if the key is pressed
      • mouseX

        public static int mouseX()
        Get the mouse x coordinate using the screens coordinate system.
        Returns:
        x coordinate
      • mouseY

        public static int mouseY()
        Get the mouse y coordinate using the screens coordinate system.
        Returns:
        y coordinate
      • mouseButton

        public static boolean mouseButton()
        Check to see if a mouse button is down.
        Returns:
        true if a button is down
      • mouseButton1

        public static boolean mouseButton1()
        Check to see if the first mouse button is down.
        Returns:
        true if button 1 is down
      • mouseButton2

        public static boolean mouseButton2()
        Check to see if the second mouse button is down.
        Returns:
        true if button 2 is down
      • mouseButton3

        public static boolean mouseButton3()
        Check to see if the third mouse button is down.
        Returns:
        true if button 3 is down
      • canvasX

        public static double canvasX​(double screenX)
        Converts screen coordinates to canvas coordinates.
        Parameters:
        screenX - screen x coordinate
        Returns:
        canvas x coordinate
      • canvasY

        public static double canvasY​(double screenY)
        Converts screen coordinates to canvas coordinates.
        Parameters:
        screenY - screen y coordinate
        Returns:
        canvas y coordinate
      • screenX

        public static double screenX​(double canvasX)
      • screenY

        public static double screenY​(double canvasY)