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 ?
Asked
Active
Viewed 2.2k times
2 Answers
28
You can use getLocation() or getLocationOnScreen() method of JFrame which are inherited from java.awt.Component.
Harry Joy
- 58,650
- 30
- 162
- 207
0
you have to implement the MouseListener Interface and call the override methods
public void mouseEntered(MouseEvent me)
and use
MouseEvent.getX();
MouseEvent.getXOnScreen();
Madhawa Priyashantha
- 9,633
- 7
- 33
- 60
Ajmal Muhammad P
- 9
- 4