Java Swing Tutorial - Java Robot.keyRelease(int keycode)








Syntax

Robot.keyRelease(int keycode) has the following syntax.

public void keyRelease(int keycode)

Example

In the following code shows how to use Robot.keyRelease(int keycode) method.

/*  w ww .ja  v a 2s.co m*/
import java.awt.Robot;
import java.awt.event.KeyEvent;

public class Main {
  public static void main(String[] argv) throws Exception {

    Robot robot = new Robot();

    robot.keyPress(KeyEvent.VK_A);
    robot.keyRelease(KeyEvent.VK_A);

  }
}