Robots

From time to time, software developers need to automate software execution (as in self- running demos) and testing. In each case, a robot (an autonomous program) programmatically delivers events describing keystrokes, mouse clicks, and mouse movements to the program being controlled.

Version 1.3 of the Java 2 Platform Standard Edition introduces a class called Robot. The methods in this class programmatically deliver keystroke and mouse events to the native windowing system's event queue.

To use Robot, you must first create an object. For example, the following code fragment creates a Robot object.

Robot r = new Robot ();

After you have a Robot object, you can issue method calls. For example, you can send keystroke events by calling ...

Get Special Edition Using Java 2 Standard Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.