So I'm using a pretty standard JPanel design for my game. I'm trying to test out using mouselisteners, but the getX() and getY() methods both seem to return inaccurate coordinates. When I draw a test string out on the screen at say, (100,100), and then click the on the area around the string, the getX and getY is returning values almost 100 pixels larger than what it should be. Does anyone know what I'm doing wrong exactly? I'll post some code.
Are you sure it's not due to your scaling? Have you tried applying the scaling factor to the mouse coordinates obtained by the mouseClicked() event or conversely have you tried removing the scaling in the drawToScreen() method as a test to see if the co-ordinates line up?