Java Swing Tutorial - Java Robot.setAutoDelay(int ms)








Syntax

Robot.setAutoDelay(int ms) has the following syntax.

public void setAutoDelay(int ms)

Example

In the following code shows how to use Robot.setAutoDelay(int ms) method.

import java.awt.Robot;
//from   w ww  . j av a 2s  .c  om
public class Main {
  public static void main(String[] args) throws Exception {
    Robot robot = new Robot();

    robot.setAutoDelay(1000);
    System.out.println(robot.getAutoDelay());
    
  }
}

The code above generates the following result.