Java Robot.mouseMove(int x, int y)

Syntax

Robot.mouseMove(int x, int y) has the following syntax.

public void mouseMove(int x,  int y)

Example

In the following code shows how to use Robot.mouseMove(int x, int y) method.


/*from  ww  w .  j  a v a  2s .c  o  m*/
import java.awt.Robot;
import java.awt.event.InputEvent;

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 );
  }
}
  




















Home »
  Java Tutorial »
    java.awt »




BasicStroke
BorderLayout
CardLayout
Color
Cursor
Desktop
DesktopManager
DisplayMode
EventQueue
FlowLayout
FocusTraversalPolicy
Font
FontMetrics
GradientPaint
Graphics
Graphics2D
GraphicsConfiguration
GraphicsDevice
GraphicsEnvironment
GridBagConstraints
GridBagLayout
GridLayout
Image
ItemSelectable
KeyboardFocusManager
LayoutManager
LayoutManager2
Point
Rectangle
Robot
Shape
SplashScreen
SystemColor
SystemTray
TexturePaint
TrayIcon
Toolkit
Transparency