The Robot class extends the Object class so the methods of the Object class also inherited in the Robot class.
![java get mouse coordinates java get mouse coordinates](http://files.smashingmagazine.com/wallpapers/june-15/the-amazing-water-park/cal/june-15-the-amazing-water-park-cal-1280x960.jpg)
It waits until all events currently on the event queue have been processed. It returns a string representation of the Robot.
![java get mouse coordinates java get mouse coordinates](https://codepad.co/img/snippets/LyAVkORY.png)
It sets whether this Robot automatically invokes the waitForIdle() method after generating an event. It sets the number of milliseconds this Robot sleeps after generating an event. It moves the mouse pointer over the specified coordinates. The method returns whether this Robot automatically invokes the waitForIdle() after generating an event. It returns the color of the pixel of the specified coordinates. It returns the number of milliseconds this robot sleeps after generating an event. It is used to sleep for a specified time. The method captures an image from the screen in a rectangular shape. Java Robot Class Methods Method NameĬreateScreenCapture(Rectangle screenRect) It facilitates the three main functionalities, provides control over the mouse and keyboard, and captures the screen also. In short, the Robot class is used to control the peripherals (mouse and keyboard). The primary purpose of the Robot class is to facilitate automated testing of Java platform implementations.
![java get mouse coordinates java get mouse coordinates](http://www.mathcs.duq.edu/simon/Java6/figures/uiswing/events/MouseMotionEventDemo.gif)
By using the Robot class we will create a Java program and control the keyboard and mouse. Along with this, we will also create a Java program to control the keyboard and mouse. In this section, we will discuss the Java Robot class and its methods. In other words, we use the Java Robot class to trigger the input events, such as mouse click, keypress, etc. The class is used to generate native system input events for test automation, self-running demos, and other applications where the control of the mouse and keyboard is required. In Java, Robot is a class that belongs to the java.awt package.