Java AWT – Robot Class Example

Control or Fire Mouse and Keyboard Events in Java using AWT Robot Class

Java.awt.Robot class is used to take the control of mouse and keyboard.
Once you get the control, you can do any type of operation related to mouse and keyboard through your java code. This class is used generally for test automation.

This sample code will show the use of Robot class to handle the keyboard events.
If you run this code and open a notepad then this code will write ‘hi budy’ in the notepad.

Share This Post On: