Possible Duplicate:
how to obtain mouse click coordinates outside my window in Java
I basically need to find out the location of the mouse pointer. i've tried this:
package main;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
public class MouseListen implements MouseMotionListener{
public void mouseDragged(MouseEvent arg0) {
}
public void mouseMoved(MouseEvent arg0) {
mouseX = arg0.getX();
mouseY = arg0.getY();
}
public int mouseX, mouseY;
}
Now that only works when inside the JFrame
window. How could I possible find the x and y position of the mouse outiside the JFrame
?