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


Java KeyCode.R属性代码示例

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


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

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