I am trying to draw polygons and want to be able to click on my frame to get MouseCoordinates, to quickly turn the mental image into x / y values.
I use
System.out.println("("+ MouseInfo.getPointerInfo().getLocation().x +", "+ MouseInfo.getPointerInfo().getLocation().y +")");
but it gives me the coordinates relative to my actual screen, and not my java window.
How to make the coordinates display relative to the Java window?
source share