static EventPattern<Event, KeyEvent> keyPressed(String character, KeyCombination.Modifier... modifiers) { return keyPressed(new KeyCharacterCombination(character, modifiers)); }
static EventPattern<Event, KeyEvent> keyReleased(String character, KeyCombination.Modifier... modifiers) { return keyReleased(new KeyCharacterCombination(character, modifiers)); }
/** * Matches the given key released event regardless of modifiers; this should only be used for the rare KeyEvents * which require a pressed modifier (e.g. Shift) to generate it (e.g. "{"). If passed in a regular character * (e.g. "a") and this appears before another EventPattern (e.g. keyReleased("a", SHORTCUT_DOWN)) in an * {@link InputMap#sequence(InputMap[])}, the second EventPattern will never run. */ static EventPattern<Event, KeyEvent> keyReleasedNoMod(String character) { KeyCharacterCombination combination = new KeyCharacterCombination(character, ALL_MODIFIERS_AS_ANY); return keyReleased().onlyIf(combination::match); }
/** * Matches the given key pressed event regardless of modifiers; this should only be used for the rare KeyEvents * which require a pressed modifier (e.g. Shift) to generate it (e.g. "{"). If passed in a regular character * (e.g. "a") and this appears before another EventPattern (e.g. keyPressed("a", SHORTCUT_DOWN)) in an * {@link InputMap#sequence(InputMap[])}, the second EventPattern will never run. */ static EventPattern<Event, KeyEvent> keyPressedNoMod(String character) { KeyCharacterCombination combination = new KeyCharacterCombination(character, ALL_MODIFIERS_AS_ANY); return keyPressed().onlyIf(combination::match); }
MenuItem menu12 = new MenuItem("_Open"); menu12.getStyleClass().add("OpenMenuItem"); menu12.setAccelerator(new KeyCharacterCombination("]", KeyCombination.SHIFT_DOWN, KeyCombination.META_DOWN)); Menu menu13 = new Menu("_Submenu");