Does someone know how to disable that CTRL+C performs normal copy to clipboard. I have an application and on CTRL+C I want to perform some defined action. If I bind some other keystroke to my action it works, but with CTRL+C, CTRL+X and CTRL+V I have normal windows copy/cut/paste behaviour.
To remove a keyboard binding from an individual component, replace its entry in the component's InputMap with an invalid action name:For more on keyboard bindings, see this article (skip down to the section "JDK 1.3 Keyboard Bindings Infrastructure"):
I didn't found solution there, I don't want to remove key binding but to use ctrl-c for specific copy action. I have in popup window defined copy action and ctrl-c is binded to that action. If I open popup and then press ctrl-c my copy action is triggered, but if I press ctrl-c without opening popup than my action isn't catched, everything is copied to clipboard.
Keystroke(KeyEvent.VK_C, KeyEvent.CTRL_MASK) is asigned to copyAction, copyAction is added to ActionMap, map is bound on table on which I want to perform copy action (and other actions too) and ActionListener is set. This process is implemented long time ago(not by me) and it works for everything but this 3 specific shortcuts.
Is this being done in the JTable's InputMap/ActionMap? Is it the WHEN_ANCESTOR_OF_FOCUSED_COMPONENT InputMap? If you're getting it by calling table.getInputMap(), it's the WHEN_FOCUSED InputMap you're working with, and that's the wrong one.