Java Code Examples for javafx.scene.input.KeyEvent#isShortcutDown()
The following examples show how to use
javafx.scene.input.KeyEvent#isShortcutDown() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DockPane.java From phoebus with Eclipse Public License 1.0 | 5 votes |
/** Handle key presses of global significance like Ctrl-S to save */ private void handleGlobalKeys(final KeyEvent event) { // Check for Ctrl (Windows, Linux) resp. Command (Mac) if (! event.isShortcutDown()) return; final DockItem item = (DockItem) getSelectionModel().getSelectedItem(); if (item == null) return; final KeyCode key = event.getCode(); if (key == KeyCode.S) { if (item instanceof DockItemWithInput) { final DockItemWithInput active_item_with_input = (DockItemWithInput) item; if (active_item_with_input.isDirty()) JobManager.schedule(Messages.Save, monitor -> active_item_with_input.save(monitor)); } event.consume(); } else if (key == KeyCode.W) { if (!isFixed()) item.close(); event.consume(); } }
Example 2
Source File: StringTable.java From phoebus with Eclipse Public License 1.0 | 5 votes |
/** Handle key pressed on the table * * <p>Ignores keystrokes while editing a cell. * * @param event Key pressed */ private void handleKey(final KeyEvent event) { if (! editing) { // Toggle toolbar on Ctrl/Command T if (event.getCode() == KeyCode.T && event.isShortcutDown()) { showToolbar(! isToolbarVisible()); event.consume(); return; } // Switch to edit mode on keypress if (event.getCode().isLetterKey() || event.getCode().isDigitKey()) { @SuppressWarnings("unchecked") final TablePosition<List<ObservableCellValue>, ?> pos = table.getFocusModel().getFocusedCell(); table.edit(pos.getRow(), pos.getTableColumn()); // TODO If the cell had been edited before, i.e. the editor already exists, // that editor will be shown and it will receive the key. // But if the editor needed to be created for a new cell, // it won't receive the key?! // Attempts to re-send the event via a delayed // Event.fireEvent(table, event.copyFor(event.getSource(), table)); // failed to have any effect. } } }
Example 3
Source File: ProjectorArenaPane.java From ShootOFF with GNU General Public License v3.0 | 5 votes |
public void canvasKeyPressed(KeyEvent event) { final boolean macFullscreen = event.getCode() == KeyCode.F && event.isControlDown() && event.isShortcutDown(); if (event.getCode() == KeyCode.F11 || macFullscreen) { toggleFullScreen(); // Manually going full screen with an arena that was manually // moved to another screen final Optional<Screen> currentArenaScreen = getStageHomeScreen(arenaStage); if (!currentArenaScreen.isPresent()) return; arenaHome = currentArenaScreen.get(); setArenaScreenOrigin(arenaHome); final boolean fullyManual = !detectedProjectorScreen.isPresent() && !arenaStage.isFullScreen() && !originalArenaHomeScreen.equals(currentArenaScreen.get()); final boolean movedAfterAuto = detectedProjectorScreen.isPresent() && !arenaStage.isFullScreen() && !detectedProjectorScreen.equals(currentArenaScreen.get()); if (fullyManual || movedAfterAuto) { final double dpiScaleFactor = ShootOFFController.getDpiScaleFactorForScreen(); config.setArenaPosition(arenaStage.getX() / dpiScaleFactor, arenaStage.getY() / dpiScaleFactor); try { config.writeConfigurationFile(); } catch (ConfigurationException | IOException e) { logger.error("Error writing configuration with arena location", e); } } } }
Example 4
Source File: KeyMap.java From FxDock with Apache License 2.0 | 4 votes |
protected static KKey key(KeyEvent ev) { int flags = 0; KeyCode cd; String ch; if(ev.getEventType() == KeyEvent.KEY_PRESSED) { flags |= KEY_PRESSED; cd = ev.getCode(); ch = null; } else if(ev.getEventType() == KeyEvent.KEY_RELEASED) { flags |= KEY_RELEASED; cd = ev.getCode(); ch = null; } else if(ev.getEventType() == KeyEvent.KEY_TYPED) { flags |= KEY_TYPED; cd = null; ch = ev.getCharacter(); } else { throw new Error("?" + ev.getEventType()); } if(ev.isAltDown()) { flags |= ALT; } if(ev.isControlDown()) { flags |= CTRL; } if(ev.isMetaDown()) { flags |= META; } if(ev.isShiftDown()) { flags |= SHIFT; } if(ev.isShortcutDown()) { flags |= ACTUAL_SHORTCUT; } // D.f("key event 0x%8x %s", flags, ev.getCode()); return new KKey(flags, cd, ch); }
Example 5
Source File: EventHandlerTool.java From VocabHunter with Apache License 2.0 | 4 votes |
public static boolean isWithoutModifier(final KeyEvent event) { return !(event.isAltDown() || event.isControlDown() || event.isMetaDown() || event.isShortcutDown() || event.isShiftDown()); }
Example 6
Source File: KeyButtonEventHandler.java From jfxvnc with Apache License 2.0 | 4 votes |
private static boolean isModifierPressed(KeyEvent event) { return event.isAltDown() || event.isControlDown() || event.isMetaDown() || event.isShortcutDown(); }
Example 7
Source File: KeyHelper.java From AsciidocFX with Apache License 2.0 | 4 votes |
public static boolean isAnyDown(KeyEvent event) { return event.isShortcutDown() || event.isShiftDown() || event.isControlDown() || event.isAltDown(); }