Java Code Examples for javafx.scene.input.KeyCode#SHIFT
The following examples show how to use
javafx.scene.input.KeyCode#SHIFT .
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: JavaFxRecorderHook.java From marathonv5 with Apache License 2.0 | 6 votes |
private boolean isContextMenuKeyEvent(KeyEvent event) { if (!event.getEventType().equals(KeyEvent.KEY_PRESSED)) { return false; } if (event.getCode() == KeyCode.CONTROL || event.getCode() == KeyCode.SHIFT || event.getCode() == KeyCode.ALT || event.getCode() == KeyCode.META) { return false; } String keyText = isModifiers(event) ? ketEventGetModifiersExText(event) + "+" : ""; keyText += keyEventGetKeyText(event.getCode()); StringBuffer contextMenuText = new StringBuffer(); if (keyModifiers != null && !keyModifiers.equals("")) { contextMenuText.append(keyModifiers + "+"); } contextMenuText.append(key); return contextMenuText.toString().equals(keyText); }
Example 2
Source File: PreferencesStage.java From marathonv5 with Apache License 2.0 | 5 votes |
protected void onKeyPressed(KeyEvent e) { if (e.getCode() == KeyCode.CONTROL || e.getCode() == KeyCode.SHIFT || e.getCode() == KeyCode.ALT || e.getCode() == KeyCode.META) { return; } String keyText = OSFXUtils.isModifiers(e) ? OSFXUtils.ketEventGetModifiersExText(e) + "+" : ""; keyText += OSFXUtils.keyEventGetKeyText(e.getCode()); keyTriggerField.setText(keyText); }
Example 3
Source File: DragSupport.java From scenic-view with GNU General Public License v3.0 | 4 votes |
private boolean isModifierCorrect(KeyEvent t, KeyCode keyCode) { return (keyCode != KeyCode.ALT ^ t.isAltDown()) && (keyCode != KeyCode.CONTROL ^ t.isControlDown()) && (keyCode != KeyCode.SHIFT ^ t.isShiftDown()) && (keyCode != KeyCode.META ^ t.isMetaDown()); }
Example 4
Source File: DragSupport.java From scenic-view with GNU General Public License v3.0 | 4 votes |
private boolean isModifierCorrect(MouseEvent t, KeyCode keyCode) { return (keyCode != KeyCode.ALT ^ t.isAltDown()) && (keyCode != KeyCode.CONTROL ^ t.isControlDown()) && (keyCode != KeyCode.SHIFT ^ t.isShiftDown()) && (keyCode != KeyCode.META ^ t.isMetaDown()); }
Example 5
Source File: OSFXUtils.java From marathonv5 with Apache License 2.0 | 4 votes |
public static String keyEventGetKeyText(KeyCode keycode) { if (keycode == KeyCode.TAB) { return "Tab"; } if (keycode == KeyCode.CONTROL) { return "Ctrl"; } if (keycode == KeyCode.ALT) { return "Alt"; } if (keycode == KeyCode.SHIFT) { return "Shift"; } if (keycode == KeyCode.META) { return "Meta"; } if (keycode == KeyCode.SPACE) { return "Space"; } if (keycode == KeyCode.BACK_SPACE) { return "Backspace"; } if (keycode == KeyCode.HOME) { return "Home"; } if (keycode == KeyCode.END) { return "End"; } if (keycode == KeyCode.DELETE) { return "Delete"; } if (keycode == KeyCode.PAGE_UP) { return "Pageup"; } if (keycode == KeyCode.PAGE_DOWN) { return "Pagedown"; } if (keycode == KeyCode.UP) { return "Up"; } if (keycode == KeyCode.DOWN) { return "Down"; } if (keycode == KeyCode.LEFT) { return "Left"; } if (keycode == KeyCode.RIGHT) { return "Right"; } if (keycode == KeyCode.ENTER) { return "Enter"; } return keycode.getName(); }
Example 6
Source File: JavaFxRecorderHook.java From marathonv5 with Apache License 2.0 | 4 votes |
public static String keyEventGetKeyText(KeyCode keyCode) { if (keyCode == KeyCode.TAB) { return "Tab"; } if (keyCode == KeyCode.CONTROL) { return "Ctrl"; } if (keyCode == KeyCode.ALT) { return "Alt"; } if (keyCode == KeyCode.SHIFT) { return "Shift"; } if (keyCode == KeyCode.META) { return "Meta"; } if (keyCode == KeyCode.SPACE) { return "Space"; } if (keyCode == KeyCode.BACK_SPACE) { return "Backspace"; } if (keyCode == KeyCode.HOME) { return "Home"; } if (keyCode == KeyCode.END) { return "End"; } if (keyCode == KeyCode.DELETE) { return "Delete"; } if (keyCode == KeyCode.PAGE_UP) { return "Pageup"; } if (keyCode == KeyCode.PAGE_DOWN) { return "Pagedown"; } if (keyCode == KeyCode.UP) { return "Up"; } if (keyCode == KeyCode.DOWN) { return "Down"; } if (keyCode == KeyCode.LEFT) { return "Left"; } if (keyCode == KeyCode.RIGHT) { return "Right"; } if (keyCode == KeyCode.ENTER) { return "Enter"; } return keyCode.getName(); }
Example 7
Source File: CircuitManager.java From CircuitSim with BSD 3-Clause "New" or "Revised" License | 4 votes |
public void keyPressed(KeyEvent e) { if(e.getCode() != KeyCode.SHIFT && lastPressed == null && selectedElements.size() == 1) { lastPressed = selectedElements.iterator().next(); lastPressedConsumed = lastPressed.keyPressed(this, circuitBoard.getCurrentState(), e.getCode(), e.getText()); lastPressedKeyCode = e.getCode(); setNeedsRepaint(); } if(lastPressed != null && lastPressedConsumed) { return; } setNeedsRepaint(); switch(e.getCode()) { case RIGHT: { e.consume(); handleArrowPressed(Direction.EAST); break; } case LEFT: { e.consume(); handleArrowPressed(Direction.WEST); break; } case UP: { e.consume(); handleArrowPressed(Direction.NORTH); break; } case DOWN: { e.consume(); handleArrowPressed(Direction.SOUTH); break; } case CONTROL: isCtrlDown = true; break; case SHIFT: if(currentState != SelectingState.CONNECTION_SELECTED && currentState != SelectingState.CONNECTION_DRAGGED) { simulatorWindow.setClickMode(true); } isShiftDown = true; break; case DELETE: case BACK_SPACE: if(!getSelectedElements().isEmpty()) { mayThrow(circuitBoard::finalizeMove); mayThrow(() -> circuitBoard.removeElements(selectedElements)); reset(); } break; case ESCAPE: if(currentState == SelectingState.ELEMENT_DRAGGED) { mayThrow(() -> circuitBoard.moveElements(0, 0, false)); } reset(); break; } }