本文整理汇总了Java中javafx.scene.input.KeyCombination.match方法的典型用法代码示例。如果您正苦于以下问题:Java KeyCombination.match方法的具体用法?Java KeyCombination.match怎么用?Java KeyCombination.match使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.input.KeyCombination
的用法示例。
在下文中一共展示了KeyCombination.match方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: keyAction
import javafx.scene.input.KeyCombination; //导入方法依赖的package包/类
private void keyAction(KeyEvent event, Action add, Action edit, Action delete) {
if (event.getCode() == KeyCode.DELETE) {
if (delete != null) {
delete.act();
}
event.consume();
return;
}
if (event.getCode() == KeyCode.ENTER) {
if (edit != null) {
edit.act();
}
event.consume();
return;
}
KeyCombination combintation = new KeyCodeCombination(KeyCode.N, KeyCombination.CONTROL_DOWN);
if (combintation.match(event)) {
if (add != null) {
add.act();
}
event.consume();
return;
}
}
示例2: translationKey
import javafx.scene.input.KeyCombination; //导入方法依赖的package包/类
@FXML public void translationKey(KeyEvent event) {
try {
KeyCombination enter = new KeyCodeCombination(KeyCode.ENTER, KeyCombination.CONTROL_DOWN);
KeyCombination backspace = new KeyCodeCombination(KeyCode.BACK_SPACE, KeyCombination.CONTROL_DOWN);
if (enter.match(event)) {
next();
} else if (backspace.match(event)) {
previous();
}
} catch (Exception e) {
ExceptionController.display(e);
}
}
示例3: checkKeyCombinationEquality
import javafx.scene.input.KeyCombination; //导入方法依赖的package包/类
/**
* Check if the given keyCombination equals the given keyEvent
*
* @param combination as KeyCombination
* @param keyEvent as KeEvent
* @return true if matching, else false
*/
public static boolean checkKeyCombinationEquality(KeyCombination combination, KeyEvent keyEvent) {
KeyCode code = keyEvent.getCode();
if (code == KeyCode.UNDEFINED) {
return false;
}
return combination.match(keyEvent);
}