jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(86, java.awt.event.KeyEvent.CTRL_MASK, true));
解决方案 »
- 关于数字的算法
- POI无法提取出word2007中的图片吗
- 小问题请教高手
- 请问这是怎么回事Invalid parameter binding(s).
- 讨论:大家都在使用JAVA做哪种开发模式?
- 如何检查一个字符串是否为文件(或是目录)?
- 请教大家:这种java项目如何调试?谢谢!
- 不支持java.io.Serializable接口的对象能否通过writeObject方法写入流中?
- 高手幫忙!Socket連接數的問題(急急急!)
- 求购EditPlus注册码。
- 难道无高手,高手大虾们,在"swing"中如何给菜单项加如快捷键如ctrl v ---先谢了
- java读文件,比如有文件中有8个字节是double型,怎么它读出来,也转为double
public static KeyStroke getKeyStroke(int keyCode,
int modifiers,
boolean onKeyRelease)
Return a shared instance of a key stroke given a numeric keycode and a set of modifiers, specifying whether the key is activated when it is pressed or released.
The "virtual key" constants defined in java.awt.event.KeyEvent can be used to specify the key code. For example: java.awt.event.KeyEvent.VK_ENTER
java.awt.event.KeyEvent.VK_TAB
java.awt.event.KeyEvent.VK_SPACE
The modifiers consist of any combination of: java.awt.Event.SHIFT_MASK (1)
java.awt.Event.CTRL_MASK (2)
java.awt.Event.META_MASK (4)
java.awt.Event.ALT_MASK (8)
Since these numbers are all different powers of two, any combination of them is an integer in which each bit represents a different modifier key.
Parameters:
keyCode - an int specifying the numeric code for a keyboard keymodifiers - an int specifying any combination of the key modifiers.
onKeyRelease - a boolean value. When true, specifies that the key is active when it is released.
Returns:a KeyStroke object for that key
See Also: KeyEvent, Event