Java Robot(GraphicsDevice screen) Constructor
Syntax
Robot(GraphicsDevice screen) constructor from Robot has the following syntax.
public Robot(GraphicsDevice screen) throws AWTException
Example
In the following code shows how to use Robot.Robot(GraphicsDevice screen) constructor.
/* w ww . j a va2 s .com*/
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Robot;
public class Main {
public static void main(String[] argv) throws Exception {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
for (int i = 0; i < gs.length; i++) {
Robot robot = new Robot(gs[i]);
}
}
}
Home »
Java Tutorial »
java.awt »
Java Tutorial »
java.awt »