Swing uses Key Bindings
to map KeyStrokes
to Actions
. So you can add another binding to map "Command A" to the existing "Control A" binding.
See Key Bindings for more information on how to do this as well as a link to the Swing tutorial on How to Use Key Bindings
.
Also, check out How do you refer to the mac command key in the String version of Java's KeyStroke.getKeystroke? for information on how to specify the "command" key in a KeyStroke.
Edit:
... I wanted to do that in the EventQueue class to be applied automatically to all tables i create in my application
Yes, usually Key Bindings are applied to individual components. If you want to change bindings for all components then you need to use the UIManager to access the default InputMap. For a JTable you should be able to use:
InputMap im = (InputMap) UIManager.get("Table.ancestorInputMap");
See UIManager Defaults for more information showing the default InputMap used for each Swing component.