0

I want to call SwingUtilities.convertPointToScreen(clickPoint, component) but i want a result where the windows scaling is NOT taken into account.

When the click occurs on the primary screen the point is correct, but if the click was made on the second screen the coordinates are wrong because now the windows scaling is taken into account.

I tried to calculate the scaling out (with AffineTransform.inverseTransform()) but this seems wrong that i need to manually calculate around.

MouseInfo.getPointerInfo().getLocation(); delivers also the wrong location.

The whole problem occurs since i switched from java 11 to java 17.

enter image description here

Ben Janus
  • 19
  • 4
  • 1
    You could write a wrapper method that checks for a secondary display and divides the X and Y by the scaling factor (percentage divided by 100). As an example, 300 / 1.5 (150%) equals 200. – Gilbert Le Blanc Jul 19 '23 at 15:07
  • You wrote in your question: _`MouseInfo.getPointerInfo().getLocation();` delivers also the wrong location._ Pardon me, but how do you know that it is the wrong location? Maybe you could post a [mcve] so that I can see if it occurs on my computer as well? – Abra Jul 20 '23 at 14:01

0 Answers0