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








Syntax

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

public void delay(int ms)

Example

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

/*from w w w.j a  v a2  s .  c o m*/
import java.awt.Robot;

public class Main {
  public static void main(String[] args) throws Exception {
    Robot robot = new Robot();

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

The code above generates the following result.