Forums > Java

Not able to catch keyboard sortcuts command-w in a JDialog, it calls Max menu

Dec 22 2013 | 9:32 pm

I’m not able to do it… I’m able to catch command+’W’ (big W), but not command+’w’. I see the Max File menu blinking in the background when I press it (my JDialog has focus).

I did once in my MXJ stuff:
com.cycling74.max.MaxSystem.registerCommandAccelerators(new char[]
‘X’, ‘x’, ‘C’, ‘c’, ‘V’, ‘v’, ‘W’, ‘w’, ‘Z’, ‘z’, ‘A’, ‘a’,

I tried to do it before/after opening the JDialog, but same problem.

I feel MaxSystem.registerCommandAccelerators does nothing… Or I’m not using it properly.
I’m sure it’s called, as I put a trace when I call it.

I’m sure I can catch everything from keyboard, as every single key press is reported to my KeyEventDispatcher, registered to the main KeyboardFocusManager.

But no, command+w is not catched.

How can I achive this ? I want to catch it to implement in my java dialogs the window closing behaviour of this shortcut.


Viewing 1 post (of 1 total)

Forums > Java