public class MenuShortcut extends Object implements Serializable
MenuShortcut
class代表了一个菜单键盘加速器。
菜单快捷方式使用虚拟键码产生,不是字符。例如,一个为Ctrl-A菜单快捷方式(假设控制快捷键)会像下面这样的代码生成:
MenuShortcut ms = new MenuShortcut(KeyEvent.VK_A, false);
或者
MenuShortcut ms = new MenuShortcut(KeyEvent.getExtendedKeyCodeForChar('A'), false);
菜单快捷方式也可以建立更广泛的使用java.awt.event.KeyEvent.getExtendedKeyCodeForChar
调用代码。例如,一个“Ctrl +西里尔EF”是由菜单快捷方式
MenuShortcut ms = new MenuShortcut(KeyEvent.getExtendedKeyCodeForChar('?'), false);
注意快捷方式创建一个键码或扩展键码定义为一个常数KeyEvent
不管当前键盘布局。然而,捷径用扩展键码在KeyEvent
只工作不上市如果当前键盘布局产生一个相应的信。
快捷键是依赖于平台的,可通过Toolkit.getMenuShortcutKeyMask()
。
Constructor and Description |
---|
MenuShortcut(int key)
为指定的虚拟键码构造一个新的menushortcut。
|
MenuShortcut(int key, boolean useShiftModifier)
为指定的虚拟键码构造一个新的menushortcut。
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(MenuShortcut s)
是否这menushortcut相同:平等是指,menushortcuts使用相同的密钥,或者使用或不使用Shift键。
|
boolean |
equals(Object obj)
是否这menushortcut相同:平等是指,menushortcuts使用相同的密钥,或者使用或不使用Shift键。
|
int |
getKey()
返回该menushortcut原密码。
|
int |
hashCode()
返回此menushortcut hashCode。
|
protected String |
paramString()
返回表示这menushortcut状态参数字符串。
|
String |
toString()
返回一个国际化的menushortcut描述。
|
boolean |
usesShiftModifier()
是否这menushortcut必须使用Shift键调用。
|
public int getKey()
KeyEvent
public boolean usesShiftModifier()
true
menushortcut必须使用Shift键调用,
false
否则。
public boolean equals(MenuShortcut s)
s
- menushortcut进行比较。
true
相同,
false
否则。
public boolean equals(Object obj)
equals
方法重写,继承类
Object
obj
-进行比较的对象。
true
相同,
false
否则。
Object.hashCode()
,
HashMap
public int hashCode()
hashCode
方法重写,继承类
Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public String toString()
protected String paramString()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.