Java Code Examples for javafx.scene.input.KeyCode#C
The following examples show how to use
javafx.scene.input.KeyCode#C .
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: RTImagePlot.java From phoebus with Eclipse Public License 1.0 | 6 votes |
/** onKeyPressed */ private void keyPressed(final KeyEvent event) { if (! handle_keys || axisLimitsField.isVisible()) return; if (event.getCode() == KeyCode.Z) plot.getUndoableActionManager().undoLast(); else if (event.getCode() == KeyCode.Y) plot.getUndoableActionManager().redoLast(); else if (event.getCode() == KeyCode.O) showConfigurationDialog(); else if (event.getCode() == KeyCode.C) toolbar.toggleCrosshair(); else if (event.getCode() == KeyCode.T) showToolbar(! isToolbarVisible()); else if (event.isControlDown()) toolbar.selectMouseMode(MouseMode.ZOOM_IN); else if (event.isAltDown()) toolbar.selectMouseMode(MouseMode.ZOOM_OUT); else if (event.isShiftDown()) toolbar.selectMouseMode(MouseMode.PAN); else toolbar.selectMouseMode(MouseMode.NONE); event.consume(); }
Example 2
Source File: BaseMaterialFileEditor.java From jmonkeybuilder with Apache License 2.0 | 6 votes |
@Override @FxThread protected boolean handleKeyActionImpl(@NotNull final KeyCode keyCode, final boolean isPressed, final boolean isControlDown, final boolean isShiftDown, final boolean isButtonMiddleDown) { if (isPressed && keyCode == KeyCode.C && !isControlDown && !isButtonMiddleDown) { final ToggleButton cubeButton = getCubeButton(); cubeButton.setSelected(true); return true; } else if (isPressed && keyCode == KeyCode.S && !isControlDown && !isButtonMiddleDown) { final ToggleButton sphereButton = getSphereButton(); sphereButton.setSelected(true); return true; } else if (isPressed && keyCode == KeyCode.P && !isControlDown && !isButtonMiddleDown) { final ToggleButton planeButton = getPlaneButton(); planeButton.setSelected(true); return true; } else if (isPressed && keyCode == KeyCode.L && !isControlDown && !isButtonMiddleDown) { final ToggleButton lightButton = getLightButton(); lightButton.setSelected(!lightButton.isSelected()); return true; } return super.handleKeyActionImpl(keyCode, isPressed, isControlDown, isShiftDown, isButtonMiddleDown); }
Example 3
Source File: TextEditorPane.java From logbook-kai with MIT License | 6 votes |
@FXML void initialize() { WebEngine engine = this.webview.getEngine(); engine.load(PluginServices.getResource("logbook/gui/text_editor_pane.html").toString()); engine.getLoadWorker().stateProperty().addListener( (ob, o, n) -> { if (n == Worker.State.SUCCEEDED) { this.setting(); } }); KeyCombination copy = new KeyCodeCombination(KeyCode.C, KeyCombination.CONTROL_DOWN); KeyCombination cut = new KeyCodeCombination(KeyCode.X, KeyCombination.CONTROL_DOWN); this.webview.addEventHandler(KeyEvent.KEY_PRESSED, event -> { if (copy.match(event) || cut.match(event)) { String text = String.valueOf(engine.executeScript("getCopyText()")); Platform.runLater(() -> { ClipboardContent content = new ClipboardContent(); content.putString(text); Clipboard.getSystemClipboard().setContent(content); }); } }); }
Example 4
Source File: RTPlot.java From phoebus with Eclipse Public License 1.0 | 5 votes |
/** onKeyPressed */ private void keyPressed(final KeyEvent event) { if (! handle_keys || axisLimitsField.isVisible() ) return; if (event.getCode() == KeyCode.Z) plot.getUndoableActionManager().undoLast(); else if (event.getCode() == KeyCode.Y) plot.getUndoableActionManager().redoLast(); else if (event.getCode() == KeyCode.O) showConfigurationDialog(); else if (event.getCode() == KeyCode.T) showToolbar(! isToolbarVisible()); else if (event.getCode() == KeyCode.C) toolbar.toggleCrosshair(); else if (event.getCode() == KeyCode.L) plot.showLegend(! plot.isLegendVisible()); else if (event.getCode() == KeyCode.S) plot.stagger(true); else if (event.getCode() == KeyCode.A) plot.enableAutoScale(); else if (event.isControlDown()) toolbar.selectMouseMode(MouseMode.ZOOM_IN); else if (event.isAltDown()) toolbar.selectMouseMode(MouseMode.ZOOM_OUT); else if (event.isShiftDown()) toolbar.selectMouseMode(MouseMode.PAN); else toolbar.selectMouseMode(MouseMode.NONE); event.consume(); }
Example 5
Source File: Tools.java From logbook-kai with MIT License | 5 votes |
/** * キーボードイベントのハンドラー(Ctrl+Cを実装) * * @param event キーボードイベント */ public static void defaultOnKeyPressedHandler(KeyEvent event) { if (event.getSource() instanceof TableView<?>) { TableView<?> table = (TableView<?>) event.getSource(); // Copy if (event.isControlDown() && event.getCode() == KeyCode.C) { selectionCopy(table); } } }
Example 6
Source File: FeatureTableFX.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
private void setTableEditable(boolean state) { this.setEditable(true);// when character or numbers pressed it will start edit in editable // fields // enable copy on selection final KeyCodeCombination keyCodeCopy = new KeyCodeCombination(KeyCode.C, KeyCombination.CONTROL_ANY); final KeyCodeCombination keyCodeRandomComment = new KeyCodeCombination(KeyCode.R, KeyCombination.CONTROL_ANY); final KeyCodeCombination keyCodeRandomMZ = new KeyCodeCombination(KeyCode.T, KeyCombination.CONTROL_ANY); this.setOnKeyPressed(event -> { if (keyCodeCopy.match(event)) { copySelectionToClipboard(this, true); } if (keyCodeRandomComment.match(event)) { this.getSelectionModel().getSelectedItem().getValue().set(CommentType.class, ("Random" + rand.nextInt(100))); this.getSelectionModel().getSelectedItem().getValue().getFeatures().values().stream() .forEach(f -> f.set(CommentType.class, ("Random" + rand.nextInt(100)))); } if (keyCodeRandomMZ.match(event)) { this.getSelectionModel().getSelectedItem().getValue().set(MZType.class, (rand.nextDouble() * 200d)); this.getSelectionModel().getSelectedItem().getValue().getFeatures().values().stream() .forEach(f -> f.set(MZType.class, (rand.nextDouble() * 200d))); } if (event.getCode().isLetterKey() || event.getCode().isDigitKey()) { editFocusedCell(); } else if (event.getCode() == KeyCode.RIGHT || event.getCode() == KeyCode.TAB) { this.getSelectionModel().selectNext(); event.consume(); } else if (event.getCode() == KeyCode.LEFT) { this.getSelectionModel().selectPrevious(); // work around due to // TableView.getSelectionModel().selectPrevious() due to a bug // stopping it from working on // the first column in the last row of the table // selectPrevious(); event.consume(); } }); }
Example 7
Source File: AbstractSceneFileEditor.java From jmonkeybuilder with Apache License 2.0 | 4 votes |
@Override @FxThread protected boolean handleKeyActionImpl(@NotNull final KeyCode keyCode, final boolean isPressed, final boolean isControlDown, final boolean isShiftDown, final boolean isButtonMiddleDown) { final MA editor3DPart = getEditor3DPart(); if (editor3DPart.isCameraMoving()) { return false; } if (isPressed && isControlDown && keyCode == KeyCode.Z) { undo(); return true; } else if (isPressed && isControlDown && keyCode == KeyCode.Y) { redo(); return true; } else if (isPressed && keyCode == KeyCode.G && !isControlDown && !isButtonMiddleDown) { final ToggleButton moveToolButton = getMoveToolButton(); moveToolButton.setSelected(true); return true; } else if (isPressed && keyCode == KeyCode.R && !isControlDown && !isButtonMiddleDown) { final ToggleButton rotationToolButton = getRotationToolButton(); rotationToolButton.setSelected(true); return true; } else if (isPressed && keyCode == KeyCode.S && !isControlDown && !isButtonMiddleDown) { final ToggleButton scaleToolButton = getScaleToolButton(); scaleToolButton.setSelected(true); return true; } else if (isPressed && keyCode == KeyCode.DELETE) { final RemoveElementsAction removeAction = findTreeAction(RemoveElementsAction.class); if (removeAction == null) { return false; } removeAction.process(); return true; } else if (isPressed && isControlDown && keyCode == KeyCode.C) { //TODO } else if (isPressed && isControlDown && keyCode == KeyCode.V) { //TODO } return super.handleKeyActionImpl(keyCode, isPressed, isControlDown, isShiftDown, isButtonMiddleDown); }
Example 8
Source File: ResourceTree.java From jmonkeybuilder with Apache License 2.0 | 4 votes |
/** * Handle hotkeys. */ @FxThread private void processKey(@NotNull KeyEvent event) { if (isReadOnly()) { return; } var editorConfig = EditorConfig.getInstance(); var currentAsset = editorConfig.getCurrentAsset(); if (currentAsset == null) { return; } updateSelectedElements(); var selectedElements = getSelectedElements(); if (selectedElements.isEmpty()) { return; } var firstElement = selectedElements.first(); if (firstElement instanceof LoadingResourceElement) { return; } boolean onlyFiles = true; boolean onlyFolders = true; boolean selectedAsset = false; for (var element : selectedElements.array()) { if (element == null) { break; } if (element instanceof FileResourceElement) { onlyFolders = false; } else if (element instanceof FolderResourceElement) { onlyFiles = false; } if (Objects.equals(currentAsset, element.getFile())) { selectedAsset = true; } } var actionTester = getActionTester(); var keyCode = event.getCode(); var controlDown = event.isControlDown(); if (!currentAsset.equals(firstElement.getFile())) { if (controlDown) { if (keyCode == KeyCode.C && actionTester.test(CopyFileAction.class) && !selectedAsset && (onlyFiles || selectedElements.size() == 1)) { CopyFileAction.applyFor(selectedElements); } else if (keyCode == KeyCode.X && actionTester.test(CutFileAction.class) && !selectedAsset && (onlyFiles || selectedElements.size() == 1)) { CutFileAction.applyFor(selectedElements); } } else if (keyCode == KeyCode.DELETE && actionTester.test(DeleteFileAction.class) && !selectedAsset && (onlyFiles || selectedElements.size() == 1)) { DeleteFileAction.applyFor(selectedElements); } } if (controlDown && keyCode == KeyCode.V && hasFileInClipboard() && actionTester.test(PasteFileAction.class)) { PasteFileAction.applyFor(firstElement); } }