I encountered this problem in the game I am writing, but reproduced the problem on a separate bank, consisting only of a frame, a panel and a mouse movement listener.
The problem is that I draw a rectangle - for example, in x:512, y:384 (48x48) .
Using the mouse's motion listener on the frame, it always reports about the Y axis about 25 pixels less. Therefore, when the coordinate of the rectangle should be x:512, y:384 , the mouse listener reports x:512, y:409 .
Theoretically, I can just add the difference to the Y mouse, but I need to understand why this is happening.
Full code for three example classes
source share