Does anybody know if it's possible to make the OS not process events like the windows key, or the ctrl+esc combination for example?
It would also be great if it's possible to disable only a few of them, as alt+tab and alt+f4 are useful to keep.
Thanks in advance
Rene
You can try to catch them in your app, then the dispatcher will let them away without sending back to the system events ::).
Can you please be a bit more specific? Do you mean I should use a JFrame, and add a KeyListener to it to catch the events?
Not exactly : just add a link (once) to the keyboard manager to catch the specific events in a static area
KeyboardFocusManager.getDefault...().addKeyEventDispatcher(new KeyEventDispatcher() {
public boolean distpatchKeyEvent(KeyEvent e) {
// check the keycode (may ID pressed or released or both...)
if(e.getKeyCode() == KeyEvent.VK_WINDOWS || andOTHERKEYS...) // I don't know the correct identifier though
return true; // THIS LINE OVERRIDES ALL SUBSEQUENT DISPATCHERS.
else return false;
}
});
That SHOULD be OK. =)
Nope, I'm afraid it doesn't work. The KeyEventDispatcher doesn't receive any key events at all! Any idea what might be wrong?