- java.lang.Object
-
- javafx.scene.input.KeyCombination
-
- javafx.scene.input.KeyCodeCombination
-
public final class KeyCodeCombination extends KeyCombination
该类表示其主键由其KeyCode指定的组合键。 这种按键组合独立于键组合匹配时由用户配置的键盘功能布局。- 从以下版本开始:
- JavaFX 2.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javafx.scene.input.KeyCombination
KeyCombination.Modifier, KeyCombination.ModifierValue
-
-
Field Summary
-
Fields inherited from class javafx.scene.input.KeyCombination
ALT_ANY, ALT_DOWN, CONTROL_ANY, CONTROL_DOWN, META_ANY, META_DOWN, NO_MATCH, SHIFT_ANY, SHIFT_DOWN, SHORTCUT_ANY, SHORTCUT_DOWN
-
-
构造方法摘要
构造方法 Constructor 描述 KeyCodeCombination(KeyCode code, KeyCombination.Modifier... modifiers)为指定的主键和指定的修饰符列表构造一个KeyCodeCombination。KeyCodeCombination(KeyCode code, KeyCombination.ModifierValue shift, KeyCombination.ModifierValue control, KeyCombination.ModifierValue alt, KeyCombination.ModifierValue meta, KeyCombination.ModifierValue shortcut)为指定的主键构建一个KeyCodeCombination,并显式指定所有修改键。
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 booleanequals(Object obj)测试这个KeyCodeCombination是否等于指定的对象。KeyCodegetCode()获取与该组合关联的键码。StringgetDisplayText()返回适合在用户界面中显示的KeyCombination的字符串表示(例如,在菜单项旁边)。StringgetName()返回此KeyCodeCombination的字符串表示KeyCodeCombination。inthashCode()返回此KeyCodeCombination的哈希码值。booleanmatch(KeyEvent event)测试此组合是否与给定的KeyEvent组合键匹配。-
Methods inherited from class javafx.scene.input.KeyCombination
getAlt, getControl, getMeta, getShift, getShortcut, keyCombination, toString, valueOf
-
-
-
-
构造方法详细信息
-
KeyCodeCombination
public KeyCodeCombination(KeyCode code, KeyCombination.ModifierValue shift, KeyCombination.ModifierValue control, KeyCombination.ModifierValue alt, KeyCombination.ModifierValue meta, KeyCombination.ModifierValue shortcut)
为指定的主键构建一个KeyCodeCombination,并显式指定所有修改键。 每个修饰键可设置为PRESSED,RELEASED或者IGNORED。- 参数
-
code- 主键的键码 -
shift- 修改键值shift -
control-control修改键的值 -
alt- 修改键值alt -
meta- 修改键值meta -
shortcut- 修改键值shortcut
-
KeyCodeCombination
public KeyCodeCombination(KeyCode code, KeyCombination.Modifier... modifiers)
为指定的主键和指定的修饰符列表构造一个KeyCodeCombination。 未明确列出的所有修饰键都设置为默认值RELEASED。所有可能修改默认修饰符值的修饰符都定义为
KeyCombination类中的KeyCombination。- 参数
-
code- 主键的键码 -
modifiers- 修饰键的列表及其对应的值
-
-
方法详细信息
-
getCode
public final KeyCode getCode()
获取与该组合关联的键码。- 结果
- 与该组合键相关的键码
-
match
public boolean match(KeyEvent event)
测试此键组合是否与给定的KeyEvent组合键匹配。 它仅在测试中使用KeyEvent的键代码和修改键的状态。 这意味着该方法只能为KEY_PRESSED和KEY_RELEASED事件返回true,但不能KEY_TYPED没有有效密钥代码的KEY_TYPED事件。- 重写:
-
match在KeyCombination - 参数
-
event- 关键事件 - 结果
-
true如果键组合匹配,否则为false
-
getName
public String getName()
返回此KeyCodeCombination的字符串表示KeyCodeCombination。字符串表示由加上字符分隔的部分组成。 每个部分指定一个修饰符键或主键。
修饰符键部分包含修改键的
KeyCode名称。 可以使用Ignored关键字作为前缀。 非前缀修饰符键意味着其PRESSED值,而前缀版本意味着IGNORED值。 如果在字符串中没有指定某些修饰符键,则表示它具有默认值RELEASED。主键部分包含主键的键代码名称,是返回字符串中的最后一部分。
- 重写:
-
getName在KeyCombination - 结果
-
这个
KeyCodeCombination的字符串表示
-
getDisplayText
public String getDisplayText()
返回适用于在用户界面中显示的KeyCombination的字符串表示(例如,在菜单项旁边)。- 重写:
-
getDisplayText在KeyCombination - 结果
-
这个
KeyCombination字符串表示,适合在用户界面中显示。
-
equals
public boolean equals(Object obj)
测试这个KeyCodeCombination是否等于指定的对象。- 重写:
-
equals在KeyCombination - 参数
-
obj- 要比较的对象 - 结果
-
true如果对象相等,否则为false - 另请参见:
-
Object.hashCode(),HashMap
-
hashCode
public int hashCode()
返回此KeyCodeCombination的哈希码值。- 重写:
-
hashCode在KeyCombination - 结果
- 哈希码值
- 另请参见:
-
Object.equals(java.lang.Object),System.identityHashCode(java.lang.Object)
-
-