Class DefaultSystemCalls

  • All Implemented Interfaces:
    SystemCalls

    public class DefaultSystemCalls
    extends java.lang.Object
    implements SystemCalls
    • Constructor Detail

      • DefaultSystemCalls

        public DefaultSystemCalls​(java.awt.Robot robot)
    • Method Detail

      • sleep

        public void sleep​(long time)
                   throws java.lang.InterruptedException
        Specified by:
        sleep in interface SystemCalls
        Throws:
        java.lang.InterruptedException
      • setMousePosition

        public void setMousePosition​(int x,
                                     int y)

        Moves the mouse to specified pixel using the provided Robot.

        It seems there is a certain delay, measurable in less than milliseconds, before the mouse actually ends up on the requested pixel when using a Robot class. this usually isn't a problem, but when we ask the mouse position right after this call, there's extremely low but real chance we get wrong information back. I didn't add sleep here as it would cause overhead to sleep always, even when we don't instantly use the mouse position, but just acknowledged the issue with this warning. (Use fast unrestricted loop of Robot movement and checking the position after every move to invoke the issue.)

        Specified by:
        setMousePosition in interface SystemCalls
        Parameters:
        x - the x-coordinate
        y - the y-coordinate