static L onGlobalKeyPress_listeners = synchroList(); // f: voidfunc(NativeKeyEvent) static void onGlobalKeyPress(fO f) { jnativehook_init(); GlobalScreen.addNativeKeyListener(addAndReturn(onGlobalKeyPress_listeners, new NativeKeyAdapter { public void nativeKeyPressed(NativeKeyEvent e) { pcallF(f, e); } })); } static void cleanMeUp_onGlobalKeyPress() { for (NativeKeyAdapter a : getAndClearList(onGlobalKeyPress_listeners)) GlobalScreen.removeNativeKeyListener(a); }