I came across this problem in a game I'm writing but have reproduced the issue on a separate jar that consists only of a frame, a panel, and a mouse motion listener.
The issue is that I draw a rectangle - for example at x:512, y:384 (48x48)
.
Using a mouse motion listener on the frame, it always reports the Y axis around 25 pixels less. So while the coord of the rectangle should be x:512, y:384
, the mouse motion listener reports as x:512, y:409
.
I theoretically could just add the difference to the mouse Y, but I need to understand why this happening.