-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
6
-
x86
-
windows_vista
Use the test case below to reproduce this bug.
In the test case robot will move mouse pointer to given screen coordinates (button's top-left corner). After that we retrieve mouse location using MouseInfo.getPointerInfo(). You will see that this location will be different from the initially given coordinates. Moreover, it possible to observe that mouse will be placed higher that top-left corner of button.
Not reproducible on XP.
============================ TEST CASE =============
import java.awt.*;
import java.awt.event.*;
import java.security.*;
public class testcase{
final static Button button = new Button("button");
public static final void main(String args[]){
Frame frame = new Frame("frame");
frame.setLayout(new FlowLayout());
frame.add(button);
frame.setBounds(100,100,100,100);
frame.setVisible(true);
(new Thread(){
public void run(){
try{
Thread.sleep(1000);
Robot robot = new Robot();
Point point = button.getLocationOnScreen();
System.out.println("* move to (x,y): "+point.x+","+point.y);
robot.mouseMove(point.x, point.y);
robot.delay(100);
Point pointer = (Point)AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return MouseInfo.getPointerInfo().getLocation();
}
});
System.out.println("* pointerinfo (x,y):"+pointer.x+","+pointer.y);
}catch(Exception e){
System.out.println(e);
}
}
}).start();
}
}
reproducible with dpi setting - 120 pixels per inch
In the test case robot will move mouse pointer to given screen coordinates (button's top-left corner). After that we retrieve mouse location using MouseInfo.getPointerInfo(). You will see that this location will be different from the initially given coordinates. Moreover, it possible to observe that mouse will be placed higher that top-left corner of button.
Not reproducible on XP.
============================ TEST CASE =============
import java.awt.*;
import java.awt.event.*;
import java.security.*;
public class testcase{
final static Button button = new Button("button");
public static final void main(String args[]){
Frame frame = new Frame("frame");
frame.setLayout(new FlowLayout());
frame.add(button);
frame.setBounds(100,100,100,100);
frame.setVisible(true);
(new Thread(){
public void run(){
try{
Thread.sleep(1000);
Robot robot = new Robot();
Point point = button.getLocationOnScreen();
System.out.println("* move to (x,y): "+point.x+","+point.y);
robot.mouseMove(point.x, point.y);
robot.delay(100);
Point pointer = (Point)AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return MouseInfo.getPointerInfo().getLocation();
}
});
System.out.println("* pointerinfo (x,y):"+pointer.x+","+pointer.y);
}catch(Exception e){
System.out.println(e);
}
}
}).start();
}
}
reproducible with dpi setting - 120 pixels per inch
- duplicates
-
JDK-6395346 Need to make Java process High-DPI-aware on Windows Vista
- Resolved