java - get mouse events outside of a component
drag, frame, java, location, mouse
Solution
Since java 1.5
import java.awt.MouseInfo;
public class Mouse {
public static void main(String[] args) {
while ( true ) {
System.out.println( MouseInfo.getPointerInfo().getLocation() );
}
}
}
EDIT:
Native keyboard mouse hook
http://www.jotschi.de/?p=90
Problem
i'm having the same issue as the person here, in that i need to track a frame location while it is being dragged on OS X. The question had not been resolved there, so: how do i tell a frame that a mouse down event happened on its (OS-native) title bar or, more generally, that a mouse down event happened somewhere on the screen?