1

I want leftCanvas to capture all keyboard events, including Control + Space. How can I achieve that since it is triggering the native InputMethod?

class leftCanvas extends Canvas implements KeyListener {
    leftCanvas() {
        addKeyListener(this);
        enableInputMethods(false);
    }
    public void keyTyped(KeyEvent event) {
        System.out.println(event.getKeyChar());
        event.consume();
    }
    public void keyPressed(KeyEvent event) {
        event.consume();
    }
    public void keyReleased(KeyEvent event) {
        event.consume();
    }
}
gobernador
  • 5,659
  • 3
  • 32
  • 51
chaoys
  • 21
  • 3

1 Answers1

1

I have to deal with system global hotkeys, like Super + E.

It seems JNI is necessary, and I found the project jnativehook which looks really good!

gobernador
  • 5,659
  • 3
  • 32
  • 51
chaoys
  • 21
  • 3