My boilerplate listener:
class MyMouseMotionListener implements MouseMotionListener {
public void mouseDragged(MouseEvent e) {
System.out.println("Dragged...");
}
public void mouseMoved(MouseEvent e) {
System.out.println("Moved...");
}}
Simple enough, but what do I add it to in order to listen to system-wide events? I've been researching are things like the GraphicsDevice and AccessibleContext subclasses -- they don't offer the addition of MouseMotionListeners directly but I was hoping they might give me some idea as to how I could implement this.
Edit: This isn't at all event-based but I've found this:
MouseInfo.getPointerInfo().getLocation()
Does actually return the mouse position outside the context of my app, even when the app itself does not have focus. Is there any way to observe this and dispatch an event if its value has changed?