// monitoring all events. Make sure your event handler is quick! Toolkit.getDefaultToolkit().addAWTEventListener( new AWTEventListener() { // every event fitting the mask will come through here public void eventDispatched( AWTEvent event ) { // ... } }, AWTEvent.KEY_EVENT_MASK | AWTEvent.COMPONENT_EVENT_MASK | AWTEvent.FOCUS_EVENT_MASK | AWTEvent.TEXT_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK );