Java Code Examples for javafx.scene.input.KeyCode#Y

The following examples show how to use javafx.scene.input.KeyCode#Y . 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 vote down vote up
/** 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: BaseFileEditor.java    From jmonkeybuilder with Apache License 2.0 6 votes vote down vote up
@FxThread
@Override
protected boolean handleKeyActionImpl(@NotNull final KeyCode keyCode, final boolean isPressed,
                                      final boolean isControlDown, final boolean isShiftDown,
                                      final boolean isButtonMiddleDown) {

    if (isPressed && isControlDown && keyCode == KeyCode.Z) {
        undo();
        return true;
    } else if (isPressed && isControlDown && isShiftDown && keyCode == KeyCode.Z) {
        redo();
        return true;
    } else if (isPressed && isControlDown && keyCode == KeyCode.Y) {
        redo();
        return true;
    }

    return super.handleKeyActionImpl(keyCode, isPressed, isControlDown, isShiftDown, isButtonMiddleDown);
}
 
Example 3
Source File: RTPlot.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
/** 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 4
Source File: AbstractSceneFileEditor.java    From jmonkeybuilder with Apache License 2.0 4 votes vote down vote up
@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);
}