开发者

Short cut keys in java

How can I write programs for shortcut 开发者_如何学运维keys in java. For Example, ctrl+s means the save option should work. Can anyone help?


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.


You want to read the Java tutorial for Key Listeners


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜