本文整理汇总了Java中javafx.scene.input.KeyCode.S属性的典型用法代码示例。如果您正苦于以下问题:Java KeyCode.S属性的具体用法?Java KeyCode.S怎么用?Java KeyCode.S使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javafx.scene.input.KeyCode
的用法示例。
在下文中一共展示了KeyCode.S属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleKeyActionImpl
@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);
}
示例2: processKeyPressed
/**
* Handle the key pressed event.
*
* @param event the event
*/
@FXThread
protected void processKeyPressed(@NotNull final KeyEvent event) {
final KeyCode code = event.getCode();
if (code == KeyCode.S && event.isControlDown() && isDirty()) {
save();
} else if (handleKeyActionImpl(code, true, event.isControlDown(), event.isShiftDown(), false)) {
event.consume();
}
}
示例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);
}