I’m trying to draw Polygons and would like to be able to click on my Frame to get MouseCoordinates so as to turn a mental Image into x/y values more quickly.
I’m using
System.out.println("("+ MouseInfo.getPointerInfo().getLocation().x +",
"+ MouseInfo.getPointerInfo().getLocation().y +")");
but this give me coordinates relative to my actual screen, and not my java window.
How can I make the coordinates show up relative to the Java Window?
I suppose you add a MouseListener to your frame? Then you can just get the relative coordinates with MouseEvent.getPoint