本文整理匯總了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);
}