I am trying to find the Starting location/position of the JFrame in order to map the mouse cursor from the JFrame window to desktop. Is there anyway to find the X,Y position of JFrame ?
You can use getLocation() or getLocationOnScreen() method of JFrame which are inherited from java.awt.Component.
Ajmal Muhammad P
you have to implement the MouseListener Interface and call the override methods
public void mouseEntered(MouseEvent me)
and use
MouseEvent.getX();
MouseEvent.getXOnScreen();
Jframe.getX() // that will give you location of top left X coordinate of your jframe
Jframe.getY() // that will give you location of top left Y coordinate of your jframe
来源:https://stackoverflow.com/questions/7950726/find-the-location-position-of-jframe-in-the-window