I can get the Position of the cursor by the following code, but I don`t understand how the coordinates are calculated.
MouseInfo.getPointerInfo().getLocation();
If the mouse is in the right top corner the coordinates are "java.awt.Point[x=2047,y=0]", but the resolution of my screen is 2560 x 1440 so I expected the coordinates to be [x=2560,y=0].
So how are these coordinated calculated?
When I try something like:
while(true){
System.out.println(MouseInfo.getPointerInfo().getLocation());
Thread.sleep(1000);
}
Its printing out:
java.awt.Point[x=1919,y=0]
And I got 1920 1080
So its seems to be some problem with your screen/system. Are you sure your system "knows" that you have such a screen?
My windows options for "Display -> Scale and layout" are set to 125%. Thats the problem, if i set it to 100% it works like expected.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.