Ben Janus
Ben Janus

Reputation: 19

Can SwingUtilities.getLocationOnScreen() ignore windows scaling?

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

Upvotes: 0

Views: 59

Answers (0)

Related Questions