我希望leftCanvas捕获所有键盘事件,包括Control + Space。既然它触发了本机,我该如何实现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();
}
}