Reputation: 107
How can I write programs for shortcut keys in java. For Example, ctrl+s means the save option should work. Can anyone help?
Upvotes: 0
Views: 678
Reputation: 6330
If you're developing on Mac OS X, use accelerators instead of mnenomics, which are not suppported under the native look and feel Apple Java development guide
Upvotes: 0
Reputation: 324098
Swing was designed to use Key Bindings for this type of functionality. You create an Action and map a KeyStroke to invoke this Action. Read the section from the Swing tutorial on How to Write an Action for more information.
Upvotes: 0
Reputation: 10493
Basically you're need to set mnemonics for appropriate buttons. Also you can set some accelerators for menu items. Here is a rather good example.
Upvotes: 3