+
+ private void initNativeHook() {
+ try {
+ GlobalScreen.registerNativeHook();
+ GlobalScreen.addNativeKeyListener(new NativeKeyAdapter() {
+ @Override
+ public void nativeKeyPressed(NativeKeyEvent e) {
+ System.out.println("key code = " + e.getKeyCode() + ", key text = '" + NativeKeyEvent.getKeyText(e.getKeyCode()) + "'");
+ }
+ });
+ GlobalScreen.addNativeMouseMotionListener(new NativeMouseMotionAdapter() {
+ @Override
+ public void nativeMouseMoved(NativeMouseEvent e) {
+ System.out.println("mouse point = " + e.getPoint());
+ }
+ });
+ } catch (NativeHookException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void turnOff() {
+ cleanup();
+ ledController.onFrame(LedFrame.from(config).fillColor(0, 0, 0));
+ }