Java Swing Tutorial - Java Robot.mouseRelease(int buttons)








Syntax

Robot.mouseRelease(int buttons) has the following syntax.

public void mouseRelease(int buttons)

Example

In the following code shows how to use Robot.mouseRelease(int buttons) method.

import java.awt.Robot;
import java.awt.event.InputEvent;
//from   www .j a  va  2  s  .  co m
public class Main {

  public static void main(String[] args) throws Exception{

    Robot r = new Robot();
    r.mouseMove(35,35);
    r.mousePress( InputEvent.BUTTON1_MASK );
    r.mouseRelease( InputEvent.BUTTON1_MASK );
    Thread.sleep(50);
    r.mousePress( InputEvent.BUTTON1_MASK );
    r.mouseRelease( InputEvent.BUTTON1_MASK );
  }
}