Interface IMouseAPI


  • public interface IMouseAPI
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  IMouseAPI.CrossColor  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DEFAULT_SPEED  
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean click()
      Clicks the left mouse button.
      boolean click​(boolean rightClick)
      Clicks the left or right mouse button.
      boolean click​(int x, int y)
      Moves the mouse and clicks at the given x,y coordinates.
      boolean click​(int x, int y, boolean rightClick)
      Moves the mouse and clicks at the given x,y coordinates.
      boolean click​(Clickable clickable)
      Moves the mouse and clicks on the given clickable entity.
      boolean click​(Clickable clickable, boolean rightClick)
      Moves the mouse and clicks on the given clickable entity.
      boolean click​(java.awt.Point location)
      Moves the mouse and clicks on the given location.
      boolean click​(java.awt.Point location, boolean rightClick)
      Moves the mouse and clicks on the given location.
      boolean click​(java.awt.Shape shape)
      Moves the mouse and clicks on a random point on the given shape.
      boolean click​(java.awt.Shape shape, boolean rightClick)
      Moves the mouse and clicks on a random point on the given shape.
      boolean doubleClick​(java.awt.Point randomPoint)  
      boolean drag​(java.awt.Point end)
      Drags the mouse from the current mouse location to the given location.
      boolean drag​(java.awt.Point start, java.awt.Point end)
      Drags the mouse to the start location if not already there and drags the mouse to the given end location.
      boolean drag​(java.awt.Point start, java.awt.Point end, int button)
      Drags the mouse to the start location if not already there and drags the mouse to the given end location.
      java.awt.Point getLastLocation()
      Gets the last known mouse location before it went of screen.
      java.awt.Point getLocation()
      Gets the current mouse location.
      IMouseAPI.CrossColor getMouseCrossColor()  
      int getMouseCrossState()  
      int getMouseCrossX()  
      int getMouseCrossY()  
      int getMoveSpeedTime()
      Returns the base mouse movement speed in milliseconds.
      int getX()
      Gets the current x-coordinate of the mouse.
      int getY()
      Gets the current y-coordinate of the mouse.
      boolean hold​(int duration, boolean rightClick)
      Holds the left or right mouse button for a duration at the current mouse location.
      boolean hold​(java.awt.Point location, int duration, boolean rightClick)
      Holds the left or right mouse button for a duration at the given location.
      boolean isPresent()  
      boolean isPressed()  
      boolean isRightPressed()  
      boolean move​(Clickable clickable)
      Moves the mouse onto the given clickable entity.
      boolean move​(java.awt.Point location)
      Moves the mouse to the given location.
      boolean moveOffScreen()
      Simulates moving the mouse off screen.
      boolean moveRandomly()
      Moves the mouse randomly.
      boolean moveRandomly​(int maxDistance)
      Moves the mouse randomly between the maximum distance.
      boolean moveRandomly​(int minDistance, int maxDistance)
      Moves the mouse randomly between the two distances.
      boolean scroll​(boolean up)
      Scrolls the mouse wheel.
      boolean scroll​(boolean up, int times)
      Scrolls the mouse wheel.
      void setX​(int x)
      Sets the x-coordinate of the mouse.
      void setY​(int y)
      Sets the y-coordinate of the mouse.
    • Method Detail

      • isPressed

        boolean isPressed()
      • isRightPressed

        boolean isRightPressed()
      • isPresent

        boolean isPresent()
      • click

        boolean click()
        Clicks the left mouse button.
        Returns:
        true if successful, false otherwise
      • click

        boolean click​(boolean rightClick)
        Clicks the left or right mouse button.
        Parameters:
        rightClick - true to use the right mouse button, false otherwise
        Returns:
        true if successful, false otherwise
      • click

        boolean click​(int x,
                      int y)
        Moves the mouse and clicks at the given x,y coordinates.
        Parameters:
        x - the x-coordinate to move to
        y - the y-coordinate to move to
        Returns:
        true if successful, false otherwise
      • click

        boolean click​(int x,
                      int y,
                      boolean rightClick)
        Moves the mouse and clicks at the given x,y coordinates.
        Parameters:
        x - the x-coordinate to move to
        y - the y-coordinate to move to
        rightClick - true to use the right mouse button, false otherwise
        Returns:
        true if successful, false otherwise
      • click

        boolean click​(java.awt.Shape shape)
        Moves the mouse and clicks on a random point on the given shape.
        Parameters:
        shape - the shape to click on
        Returns:
        true if successful, false otherwise
      • click

        boolean click​(java.awt.Shape shape,
                      boolean rightClick)
        Moves the mouse and clicks on a random point on the given shape.
        Parameters:
        shape - the shape to click on
        rightClick - true to use the right mouse button, false otherwise
        Returns:
        true if successful, false otherwise
      • click

        boolean click​(java.awt.Point location)
        Moves the mouse and clicks on the given location.
        Parameters:
        location - the location
        Returns:
        true if successful, false otherwise
      • click

        boolean click​(java.awt.Point location,
                      boolean rightClick)
        Moves the mouse and clicks on the given location.
        Parameters:
        location - the location
        rightClick - true to use the right mouse button, false otherwise
        Returns:
        true if successful, false otherwise
      • click

        boolean click​(Clickable clickable)
        Moves the mouse and clicks on the given clickable entity.
        Parameters:
        clickable - the location
        Returns:
        true if successful, false otherwise
      • click

        boolean click​(Clickable clickable,
                      boolean rightClick)
        Moves the mouse and clicks on the given clickable entity.
        Parameters:
        clickable - the clickable entity
        rightClick - true to use the right mouse button, false otherwise
        Returns:
        true if successful, false otherwise
      • doubleClick

        boolean doubleClick​(java.awt.Point randomPoint)
      • hold

        boolean hold​(int duration,
                     boolean rightClick)
        Holds the left or right mouse button for a duration at the current mouse location.
        Parameters:
        duration - the duration to hold for
        rightClick - true to use the right mouse button, false otherwise
        Returns:
        true if successful, false otherwise
      • hold

        boolean hold​(java.awt.Point location,
                     int duration,
                     boolean rightClick)
        Holds the left or right mouse button for a duration at the given location.
        Parameters:
        location - the location to hold the mouse button at
        duration - the duration to hold for
        rightClick - true to use the right mouse button, false otherwise
        Returns:
        true if successful, false otherwise
      • move

        boolean move​(java.awt.Point location)
        Moves the mouse to the given location.
        Parameters:
        location - the location
        Returns:
        true if successful, false otherwise
      • move

        boolean move​(Clickable clickable)
        Moves the mouse onto the given clickable entity.
        Parameters:
        clickable - the entity to move the mouse to
        Returns:
        true if successful, false otherwise
      • moveOffScreen

        boolean moveOffScreen()
        Simulates moving the mouse off screen.
        Returns:
        true if successful, false otherwise
      • moveRandomly

        boolean moveRandomly()
        Moves the mouse randomly.
        Returns:
        true if successful, false otherwise
      • moveRandomly

        boolean moveRandomly​(int maxDistance)
        Moves the mouse randomly between the maximum distance.
        Parameters:
        maxDistance - The maximum distance to move.
        Returns:
        true if successful, false otherwise
      • moveRandomly

        boolean moveRandomly​(int minDistance,
                             int maxDistance)
        Moves the mouse randomly between the two distances.
        Parameters:
        minDistance - The minimum distance to move.
        maxDistance - The maximum distance to move.
        Returns:
        true if successful, false otherwise
      • scroll

        boolean scroll​(boolean up)
        Scrolls the mouse wheel.
        Parameters:
        up - true to scroll up, false to scroll down
        Returns:
        true if successful, false otherwise
      • scroll

        boolean scroll​(boolean up,
                       int times)
        Scrolls the mouse wheel.
        Parameters:
        up - true to scroll up, false to scroll down
        times - the number of times the scroll wheel should be rolled
        Returns:
        true if successful, false otherwise
      • drag

        boolean drag​(java.awt.Point end)
        Drags the mouse from the current mouse location to the given location.
        Parameters:
        end - the location to stop dragging at
        Returns:
        true if successful, false otherwise
      • drag

        boolean drag​(java.awt.Point start,
                     java.awt.Point end)
        Drags the mouse to the start location if not already there and drags the mouse to the given end location.
        Parameters:
        start - the location to start dragging at
        end - the location to stop dragging at
        Returns:
        true if successful, false otherwise
      • drag

        boolean drag​(java.awt.Point start,
                     java.awt.Point end,
                     int button)
        Drags the mouse to the start location if not already there and drags the mouse to the given end location.
        Parameters:
        start - the location to start dragging at
        end - the location to stop dragging at
        button - the mouse button to hold during the operation, see MouseEvent, defaults to left-click button (MouseEvent.BUTTON1)
        Returns:
        true if successful, false otherwise
      • getX

        int getX()
        Gets the current x-coordinate of the mouse.
        Returns:
        the x-coordinate or -1 if the mouse is not present
      • getY

        int getY()
        Gets the current y-coordinate of the mouse.
        Returns:
        the y-coordinate or -1 if the mouse is not present
      • setX

        void setX​(int x)
        Sets the x-coordinate of the mouse.
      • setY

        void setY​(int y)
        Sets the y-coordinate of the mouse.
      • getLocation

        java.awt.Point getLocation()
        Gets the current mouse location.
        Returns:
        Point
        See Also:
        getX(), getY()
      • getLastLocation

        java.awt.Point getLastLocation()
        Gets the last known mouse location before it went of screen.
        Returns:
        Point
      • getMoveSpeedTime

        int getMoveSpeedTime()
        Returns the base mouse movement speed in milliseconds.
        Returns:
        milliseconds
      • getMouseCrossX

        int getMouseCrossX()
      • getMouseCrossY

        int getMouseCrossY()
      • getMouseCrossState

        int getMouseCrossState()