当前位置: 首页>>代码示例>>Java>>正文


Java KeyCode.Z属性代码示例

本文整理汇总了Java中javafx.scene.input.KeyCode.Z属性的典型用法代码示例。如果您正苦于以下问题:Java KeyCode.Z属性的具体用法?Java KeyCode.Z怎么用?Java KeyCode.Z使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javafx.scene.input.KeyCode的用法示例。


在下文中一共展示了KeyCode.Z属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleKeyActionImpl

@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);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:19,代码来源:BaseFileEditor.java

示例2: onKeyPressed

private void onKeyPressed(KeyEvent event) {
    if (event.isShortcutDown() && event.getCode() == KeyCode.Z) {
        eventBus.post(MenuActionEvent.UNDO);
        event.consume();
    } else if (event.isShortcutDown() && event.getCode() == KeyCode.Y) {
        eventBus.post(MenuActionEvent.REDO);
        event.consume();
    }
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:9,代码来源:PropertyEditorPresenter.java

示例3: handleKeyActionImpl

@Override
@FXThread
protected boolean handleKeyActionImpl(@NotNull final KeyCode keyCode, final boolean isPressed,
                                      final boolean isControlDown, final boolean isShiftDown,
                                      final boolean isButtonMiddleDown) {

    final MA editor3DState = getEditor3DState();
    if (editor3DState.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 ModelNodeTree modelNodeTree = getModelNodeTree();
        final TreeNode<?> selected = modelNodeTree.getSelected();
        if (selected == null || !selected.canRemove()) return false;

        final Object element = selected.getElement();
        final TreeNode<?> parent = selected.getParent();
        final Object parentElement = parent == null ? null : parent.getElement();

        if (element instanceof Spatial) {
            final Spatial spatial = (Spatial) element;
            execute(new RemoveChildOperation(spatial, spatial.getParent()));
        } else if (element instanceof Light && parentElement instanceof Node) {
            final Light light = (Light) element;
            execute(new RemoveLightOperation(light, (Node) parentElement));
        } else if (element instanceof Control && parentElement instanceof Spatial) {
            final Control control = (Control) element;
            execute(new RemoveControlOperation(control, (Spatial) parentElement));
        }

        return true;
    }

    return super.handleKeyActionImpl(keyCode, isPressed, isControlDown, isShiftDown, isButtonMiddleDown);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:55,代码来源:AbstractSceneFileEditor.java


注:本文中的javafx.scene.input.KeyCode.Z属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。