JDK-8196826 : java.awt.Robot does not move mouse pointer to the specified position
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7,8,9.0.4,10
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2018-02-05
  • Updated: 2018-02-13
  • Resolved: 2018-02-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbd_majorResolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 10.0.16299.214]

EXTRA RELEVANT SYSTEM CONFIGURATION :
Lenovo w540 laptop with two graphics adapters: Intel (the default one) and NVidia. All software updates and latest drivers are installed.

A DESCRIPTION OF THE PROBLEM :
The code snippet below demonstrates that java.awt.Robot does not move mouse pointer to the specified position.

Code:
public static void main(String[] args) throws Exception {
  Robot robot = new Robot();
  for(int x = 0; x < 1920; x += 192)
  {
    robot.mouseMove(x, 0);
    robot.delay(1_000);
    final Point location = MouseInfo.getPointerInfo().getLocation();
    System.out.println("Expected: " + x + "\t\tReal:" + location.getX());
  }
}

Output:
Expected: 0		Real:0.0
Expected: 192		Real:239.0
Expected: 384		Real:421.0
Expected: 576		Real:614.0
Expected: 768		Real:807.0
Expected: 960		Real:998.0
Expected: 1152		Real:1191.0
Expected: 1344		Real:1382.0
Expected: 1536		Real:1574.0
Expected: 1728		Real:1767.0

I found similar report https://bugs.openjdk.java.net/browse/JDK-8190898 which is closed as "Incomplete".  The problem is perfectly reproducible in my environment and I'm ready to provide all necessary further details about my hardware configuration (Lenovo Thinkpad laptop).

I found that calling in loop robot.mouseMove(x, 0) finally moves mouse pointer in 3-5 attempts.


REPRODUCIBILITY :
This bug can be reproduced always.


Comments
Reported with: JDK 8u162 Windows 10 Version 1703 java.awt.Robot does not move mouse pointer to the specified position. Checked this with JDK 8u162 and 10 ea b41 and could confirm the issue as reported. Results: ========== 7u80: Fail 8: Fail 8u162: Fail 9.0.4: Fail 10 ea b41: Fail This is similar to JDK-8190898 but is not restricted to a particular Windows build version.
06-02-2018