Java Code Examples for javafx.scene.Scene#setCursor()

The following examples show how to use javafx.scene.Scene#setCursor() . 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: FloodFill2D.java    From paintera with GNU General Public License v2.0 5 votes vote down vote up
public void fillAt(final double x, final double y, final long fill)
{
	if (!isVisible.getAsBoolean())
	{
		LOG.info("Selected source is not visible -- will not fill");
		return;
	}

	final int level = 0;
	final int time = 0;
	final MaskInfo<UnsignedLongType> maskInfo = new MaskInfo<>(time, level, new UnsignedLongType(fill));

	final Scene  scene          = viewer.getScene();
	final Cursor previousCursor = scene.getCursor();
	scene.setCursor(Cursor.WAIT);
	try
	{
		final Mask<UnsignedLongType> mask = source.generateMask(maskInfo, FOREGROUND_CHECK);
		final Interval affectedInterval = fillMaskAt(x, y, this.viewer, mask, source, assignment, FILL_VALUE, this.fillDepth.get());
		requestRepaint.run();
		source.applyMask(mask, affectedInterval, FOREGROUND_CHECK);
	} catch (final MaskInUse e)
	{
		LOG.debug(e.getMessage());
	} finally
	{
		scene.setCursor(previousCursor);
	}
}
 
Example 2
Source File: Text.java    From CircuitSim with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void mouseEntered(CircuitManager manager, CircuitState state) {
	Scene scene = manager.getSimulatorWindow().getScene();
	prevCursor = scene.getCursor();
	scene.setCursor(Cursor.TEXT);
	
	entered = true;
}
 
Example 3
Source File: Game2048.java    From fx2048 with GNU General Public License v3.0 5 votes vote down vote up
private void setEnhancedDeviceSettings(Stage primaryStage, Scene scene) {
    var isARM = System.getProperty("os.arch").toUpperCase().contains("ARM");
    if (isARM) {
        primaryStage.setFullScreen(true);
        primaryStage.setFullScreenExitHint("");
    }

    if (Platform.isSupported(ConditionalFeature.INPUT_TOUCH)) {
        scene.setCursor(Cursor.NONE);
    }
}
 
Example 4
Source File: ScreenCapture.java    From tools-ocr with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Constructor.
 */
public ScreenCapture(Stage mainStage) {
	data = new CaptureInfo();
	stage = mainStage;
	rootPane = new BorderPane();
	mainCanvas = new Canvas();
	mainCanvas.setCursor(Cursor.CROSSHAIR);
	mainCanvas.setStyle(CommUtils.STYLE_TRANSPARENT);
	rootPane.getChildren().add(mainCanvas);

	// Scene
	scene = new Scene(rootPane, CaptureInfo.ScreenWidth, CaptureInfo.ScreenHeight, Color.TRANSPARENT);
	scene.setCursor(Cursor.NONE);

	addKeyHandlers();

	// Canvas
	mainCanvas.setWidth(CaptureInfo.ScreenWidth);
	mainCanvas.setHeight(CaptureInfo.ScreenHeight);
	mainCanvas.setOnMousePressed(m -> {
		if (m.getButton() == MouseButton.PRIMARY) {
			data.mouseXPressed = (int) m.getX();
			data.mouseYPressed = (int) m.getY();
		}
	});

	mainCanvas.setOnMouseDragged(m -> {
		if (m.getButton() == MouseButton.PRIMARY) {
			if (m.getScreenX() >= CaptureInfo.ScreenMinX &&
					m.getScreenX() <= CaptureInfo.ScreenMaxX){
				data.mouseXNow = (int) m.getX();
			}
			else if(m.getScreenX() > CaptureInfo.ScreenMaxX){
				data.mouseXNow = CaptureInfo.ScreenWidth;
			}

			if (m.getScreenY() <= CaptureInfo.ScreenHeight){
				data.mouseYNow = (int) m.getY();
			}
			else{
				data.mouseYNow = CaptureInfo.ScreenHeight;
			}
			repaintCanvas();
		}
	});

	// graphics context 2D
	initGraphContent();
	// HideFeaturesPressed
	data.hideExtraFeatures.addListener((observable, oldValue, newValue) -> repaintCanvas());
}
 
Example 5
Source File: ResizeHelper.java    From Path-of-Leveling with MIT License 4 votes vote down vote up
@Override
public void handle(MouseEvent mouseEvent) {
    EventType<? extends MouseEvent> mouseEventType = mouseEvent.getEventType();
    Scene scene = stage.getScene();

    double mouseEventX = mouseEvent.getSceneX();
    double mouseEventY = mouseEvent.getSceneY();
    double sceneWidth = scene.getWidth();
    double sceneHeight = scene.getHeight();

    if (MouseEvent.MOUSE_MOVED.equals(mouseEventType)) {
        if (mouseEventX < border && mouseEventY < border) {
            cursorEvent = Cursor.NW_RESIZE;
        } else if (mouseEventX < border && mouseEventY > sceneHeight - border) {
            cursorEvent = Cursor.SW_RESIZE;
        } else if (mouseEventX > sceneWidth - border && mouseEventY < border) {
            cursorEvent = Cursor.NE_RESIZE;
        } else if (mouseEventX > sceneWidth - border && mouseEventY > sceneHeight - border) {
            cursorEvent = Cursor.SE_RESIZE;
        } else if (mouseEventX < border) {
            cursorEvent = Cursor.W_RESIZE;
        } else if (mouseEventX > sceneWidth - border) {
            cursorEvent = Cursor.E_RESIZE;
        } else if (mouseEventY < border) {
            cursorEvent = Cursor.N_RESIZE;
        } else if (mouseEventY > sceneHeight - border) {
            cursorEvent = Cursor.S_RESIZE;
        } else {
            cursorEvent = Cursor.DEFAULT;
        }
        scene.setCursor(cursorEvent);
    } else if (MouseEvent.MOUSE_EXITED.equals(mouseEventType) || MouseEvent.MOUSE_EXITED_TARGET.equals(mouseEventType)) {
        scene.setCursor(Cursor.DEFAULT);
    } else if (MouseEvent.MOUSE_PRESSED.equals(mouseEventType)) {
        startX = stage.getWidth() - mouseEventX;
        startY = stage.getHeight() - mouseEventY;
    } else if (MouseEvent.MOUSE_DRAGGED.equals(mouseEventType)) {
        if (!Cursor.DEFAULT.equals(cursorEvent)) {
            if (!Cursor.W_RESIZE.equals(cursorEvent) && !Cursor.E_RESIZE.equals(cursorEvent)) {
                double minHeight = stage.getMinHeight() > (border * 2) ? stage.getMinHeight() : (border * 2);
                double maxHeight = stage.getMaxHeight();
                if (Cursor.NW_RESIZE.equals(cursorEvent) || Cursor.N_RESIZE.equals(cursorEvent) || Cursor.NE_RESIZE.equals(cursorEvent)) {
                    double newHeight = stage.getHeight() - (mouseEvent.getScreenY() - stage.getY());
                    if (newHeight >= minHeight && newHeight <= maxHeight) {
                        stage.setHeight(newHeight);
                        stage.setY(mouseEvent.getScreenY());
                    } else {
                        newHeight = Math.min(Math.max(newHeight, minHeight), maxHeight);
                        // y1 + h1 = y2 + h2
                        // y1 = y2 + h2 - h1
                        stage.setY(stage.getY() + stage.getHeight() - newHeight);
                        stage.setHeight(newHeight);
                    }
                } else {
                    stage.setHeight(Math.min(Math.max(mouseEventY + startY, minHeight), maxHeight));
                }
            }

            if (!Cursor.N_RESIZE.equals(cursorEvent) && !Cursor.S_RESIZE.equals(cursorEvent)) {
                double minWidth = stage.getMinWidth() > (border * 2) ? stage.getMinWidth() : (border * 2);
                double maxWidth = stage.getMaxWidth();
                if (Cursor.NW_RESIZE.equals(cursorEvent) || Cursor.W_RESIZE.equals(cursorEvent) || Cursor.SW_RESIZE.equals(cursorEvent)) {
                    double newWidth = stage.getWidth() - (mouseEvent.getScreenX() - stage.getX());
                    if (newWidth >= minWidth && newWidth <= maxWidth) {
                        stage.setWidth(newWidth);
                        stage.setX(mouseEvent.getScreenX());
                    } else {
                        newWidth = Math.min(Math.max(newWidth, minWidth), maxWidth);
                        // x1 + w1 = x2 + w2
                        // x1 = x2 + w2 - w1
                        stage.setX(stage.getX() + stage.getWidth() - newWidth);
                        stage.setWidth(newWidth);
                    }
                } else {
                    stage.setWidth(Math.min(Math.max(mouseEventX + startX, minWidth), maxWidth));
                }
            }
        }
    }

    if (MouseEvent.MOUSE_PRESSED.equals(mouseEventType)) {
        startScreenX = mouseEvent.getScreenX();
        startScreenY = mouseEvent.getScreenY();
    } else if (MouseEvent.MOUSE_DRAGGED.equals(mouseEventType)) {
        if (Cursor.DEFAULT.equals(cursorEvent) && !stage.isMaximized()) {
            stage.setX(stage.getX() + mouseEvent.getScreenX() - startScreenX);
            startScreenX = mouseEvent.getScreenX();
            stage.setY(stage.getY() + mouseEvent.getScreenY() - startScreenY);
            startScreenY = mouseEvent.getScreenY();
        }
    }
}
 
Example 6
Source File: ResizeHelper.java    From CustomStage with Apache License 2.0 4 votes vote down vote up
@Override
public void handle(MouseEvent mouseEvent) {
    EventType<? extends MouseEvent> mouseEventType = mouseEvent.getEventType();
    Scene scene = stage.getScene();

    double mouseEventX = mouseEvent.getSceneX(),
            mouseEventY = mouseEvent.getSceneY(),
            sceneWidth = scene.getWidth(),
            sceneHeight = scene.getHeight();

    if (MouseEvent.MOUSE_MOVED.equals(mouseEventType)) {
        if (mouseEventX < border && mouseEventY < border) {
            cursorEvent = Cursor.NW_RESIZE;
        } else if (mouseEventX < border && mouseEventY > sceneHeight - border) {
            cursorEvent = Cursor.SW_RESIZE;
        } else if (mouseEventX > sceneWidth - border && mouseEventY < border) {
            cursorEvent = Cursor.NE_RESIZE;
        } else if (mouseEventX > sceneWidth - border && mouseEventY > sceneHeight - border) {
            cursorEvent = Cursor.SE_RESIZE;
        } else if (mouseEventX < border) {
            cursorEvent = Cursor.W_RESIZE;
        } else if (mouseEventX > sceneWidth - border) {
            cursorEvent = Cursor.E_RESIZE;
        } else if (mouseEventY < border) {
            cursorEvent = Cursor.N_RESIZE;
        } else if (mouseEventY > sceneHeight - border) {
            cursorEvent = Cursor.S_RESIZE;
        } else {
            cursorEvent = Cursor.DEFAULT;
        }
        scene.setCursor(cursorEvent);
    } else if (MouseEvent.MOUSE_EXITED.equals(mouseEventType) || MouseEvent.MOUSE_EXITED_TARGET.equals(mouseEventType)) {
        scene.setCursor(Cursor.DEFAULT);
    } else if (MouseEvent.MOUSE_PRESSED.equals(mouseEventType)) {
        startX = stage.getWidth() - mouseEventX;
        startY = stage.getHeight() - mouseEventY;
    } else if (MouseEvent.MOUSE_DRAGGED.equals(mouseEventType)) {
        if (!Cursor.DEFAULT.equals(cursorEvent)) {
            if (!Cursor.W_RESIZE.equals(cursorEvent) && !Cursor.E_RESIZE.equals(cursorEvent)) {
                double minHeight = stage.getMinHeight() > (border * 2) ? stage.getMinHeight() : (border * 2);
                if (Cursor.NW_RESIZE.equals(cursorEvent) || Cursor.N_RESIZE.equals(cursorEvent)
                        || Cursor.NE_RESIZE.equals(cursorEvent)) {
                    if (stage.getHeight() > minHeight || mouseEventY < 0) {
                        setStageHeight(stage.getY() - mouseEvent.getScreenY() + stage.getHeight());
                        stage.setY(mouseEvent.getScreenY());
                    }
                } else {
                    if (stage.getHeight() > minHeight || mouseEventY + startY - stage.getHeight() > 0) {
                        setStageHeight(mouseEventY + startY);
                    }
                }
            }

            if (!Cursor.N_RESIZE.equals(cursorEvent) && !Cursor.S_RESIZE.equals(cursorEvent)) {
                double minWidth = stage.getMinWidth() > (border * 2) ? stage.getMinWidth() : (border * 2);
                if (Cursor.NW_RESIZE.equals(cursorEvent) || Cursor.W_RESIZE.equals(cursorEvent)
                        || Cursor.SW_RESIZE.equals(cursorEvent)) {
                    if (stage.getWidth() > minWidth || mouseEventX < 0) {
                        setStageWidth(stage.getX() - mouseEvent.getScreenX() + stage.getWidth());
                        stage.setX(mouseEvent.getScreenX());
                    }
                } else {
                    if (stage.getWidth() > minWidth || mouseEventX + startX - stage.getWidth() > 0) {
                        setStageWidth(mouseEventX + startX);
                    }
                }
            }
        }

    }
}
 
Example 7
Source File: Game2048.java    From util4j with Apache License 2.0 4 votes vote down vote up
/**
 *
 * @param primaryStage
 */
@Override
public void start(Stage primaryStage) {
    gameManager = new GameManager();
    gameBounds = gameManager.getLayoutBounds();

    StackPane root = new StackPane(gameManager);
    root.getStyleClass().addAll("game-root");
    ChangeListener<Number> resize = (ov, v, v1) -> {
        double scale = Math.min((root.getWidth() - MARGIN) / gameBounds.getWidth(), (root.getHeight() - MARGIN) / gameBounds.getHeight());
        gameManager.setScale(scale);
        gameManager.setLayoutX((root.getWidth() - gameBounds.getWidth()) / 2d);
        gameManager.setLayoutY((root.getHeight() - gameBounds.getHeight()) / 2d);
    };
    root.widthProperty().addListener(resize);
    root.heightProperty().addListener(resize);

    Scene scene = new Scene(root);
    scene.getStylesheets().add(CSS);
    addKeyHandler(scene);
    addSwipeHandlers(scene);

    if (isARMDevice()) {
        primaryStage.setFullScreen(true);
        primaryStage.setFullScreenExitHint("");
    }

    if (Platform.isSupported(ConditionalFeature.INPUT_TOUCH)) {
        scene.setCursor(Cursor.NONE);
    }

    Rectangle2D visualBounds = Screen.getPrimary().getVisualBounds();
    double factor = Math.min(visualBounds.getWidth() / (gameBounds.getWidth() + MARGIN),
            visualBounds.getHeight() / (gameBounds.getHeight() + MARGIN));
    primaryStage.setTitle("2048FX");
    primaryStage.setScene(scene);
    primaryStage.setMinWidth(gameBounds.getWidth() / 2d);
    primaryStage.setMinHeight(gameBounds.getHeight() / 2d);
    primaryStage.setWidth((gameBounds.getWidth() + MARGIN) * factor);
    primaryStage.setHeight((gameBounds.getHeight() + MARGIN) * factor);
    primaryStage.show();
}
 
Example 8
Source File: ResizeHelper.java    From ApkToolPlus with Apache License 2.0 4 votes vote down vote up
@Override
public void handle(MouseEvent mouseEvent) {
    EventType<? extends MouseEvent> mouseEventType = mouseEvent.getEventType();
    Scene scene = stage.getScene();

    double mouseEventX = mouseEvent.getSceneX(), 
           mouseEventY = mouseEvent.getSceneY(),
           sceneWidth = scene.getWidth(),
           sceneHeight = scene.getHeight();

    if (MouseEvent.MOUSE_MOVED.equals(mouseEventType) == true) {
        if (mouseEventX < border && mouseEventY < border) {
            cursorEvent = Cursor.NW_RESIZE;
        } else if (mouseEventX < border && mouseEventY > sceneHeight - border) {
            cursorEvent = Cursor.SW_RESIZE;
        } else if (mouseEventX > sceneWidth - border && mouseEventY < border) {
            cursorEvent = Cursor.NE_RESIZE;
        } else if (mouseEventX > sceneWidth - border && mouseEventY > sceneHeight - border) {
            cursorEvent = Cursor.SE_RESIZE;
        } else if (mouseEventX < border) {
            cursorEvent = Cursor.W_RESIZE;
        } else if (mouseEventX > sceneWidth - border) {
            cursorEvent = Cursor.E_RESIZE;
        } else if (mouseEventY < border) {
            cursorEvent = Cursor.N_RESIZE;
        } else if (mouseEventY > sceneHeight - border) {
            cursorEvent = Cursor.S_RESIZE;
        } else {
            cursorEvent = Cursor.DEFAULT;
        }
        scene.setCursor(cursorEvent);
    } else if (MouseEvent.MOUSE_PRESSED.equals(mouseEventType) == true) {
        startX = stage.getWidth() - mouseEventX;
        startY = stage.getHeight() - mouseEventY;
    } else if (MouseEvent.MOUSE_DRAGGED.equals(mouseEventType) == true) {
        if (Cursor.DEFAULT.equals(cursorEvent) == false) {
            if (Cursor.W_RESIZE.equals(cursorEvent) == false && Cursor.E_RESIZE.equals(cursorEvent) == false) {
                double minHeight = stage.getMinHeight() > (border*2) ? stage.getMinHeight() : (border*2);
                if (Cursor.NW_RESIZE.equals(cursorEvent) == true || Cursor.N_RESIZE.equals(cursorEvent) == true || Cursor.NE_RESIZE.equals(cursorEvent) == true) {
                    if (stage.getHeight() > minHeight || mouseEventY < 0) {
                        stage.setHeight(stage.getY() - mouseEvent.getScreenY() + stage.getHeight());
                        stage.setY(mouseEvent.getScreenY());
                    }
                } else {
                    if (stage.getHeight() > minHeight || mouseEventY + startY - stage.getHeight() > 0) {
                        stage.setHeight(mouseEventY + startY);
                    }
                }
            }

            if (Cursor.N_RESIZE.equals(cursorEvent) == false && Cursor.S_RESIZE.equals(cursorEvent) == false) {
                double minWidth = stage.getMinWidth() > (border*2) ? stage.getMinWidth() : (border*2);
                if (Cursor.NW_RESIZE.equals(cursorEvent) == true || Cursor.W_RESIZE.equals(cursorEvent) == true || Cursor.SW_RESIZE.equals(cursorEvent) == true) {
                    if (stage.getWidth() > minWidth || mouseEventX < 0) {
                        stage.setWidth(stage.getX() - mouseEvent.getScreenX() + stage.getWidth());
                        stage.setX(mouseEvent.getScreenX());
                    }
                } else {
                    if (stage.getWidth() > minWidth || mouseEventX + startX - stage.getWidth() > 0) {
                        stage.setWidth(mouseEventX + startX);
                    }
                }
            }
        }

    }
}
 
Example 9
Source File: ResizeHelper.java    From JavaFX-Chat with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void handle(MouseEvent mouseEvent) {
    EventType<? extends MouseEvent> mouseEventType = mouseEvent.getEventType();
    Scene scene = stage.getScene();

    double mouseEventX = mouseEvent.getSceneX(),
            mouseEventY = mouseEvent.getSceneY(),
            sceneWidth = scene.getWidth(),
            sceneHeight = scene.getHeight();

    if (MouseEvent.MOUSE_MOVED.equals(mouseEventType)) {
        if (mouseEventX < border && mouseEventY < border) {
            cursorEvent = Cursor.NW_RESIZE;
        } else if (mouseEventX < border && mouseEventY > sceneHeight - border) {
            cursorEvent = Cursor.SW_RESIZE;
        } else if (mouseEventX > sceneWidth - border && mouseEventY < border) {
            cursorEvent = Cursor.NE_RESIZE;
        } else if (mouseEventX > sceneWidth - border && mouseEventY > sceneHeight - border) {
            cursorEvent = Cursor.SE_RESIZE;
        } else if (mouseEventX < border) {
            cursorEvent = Cursor.W_RESIZE;
        } else if (mouseEventX > sceneWidth - border) {
            cursorEvent = Cursor.E_RESIZE;
        } else if (mouseEventY < border) {
            cursorEvent = Cursor.N_RESIZE;
        } else if (mouseEventY > sceneHeight - border) {
            cursorEvent = Cursor.S_RESIZE;
        } else {
            cursorEvent = Cursor.DEFAULT;
        }
        scene.setCursor(cursorEvent);
    } else if(MouseEvent.MOUSE_EXITED.equals(mouseEventType) || MouseEvent.MOUSE_EXITED_TARGET.equals(mouseEventType)){
        scene.setCursor(Cursor.DEFAULT);
    } else if (MouseEvent.MOUSE_PRESSED.equals(mouseEventType)) {
        startX = stage.getWidth() - mouseEventX;
        startY = stage.getHeight() - mouseEventY;
    } else if (MouseEvent.MOUSE_DRAGGED.equals(mouseEventType)) {
        if (Cursor.DEFAULT.equals(cursorEvent) == false) {
            if (Cursor.W_RESIZE.equals(cursorEvent) == false && Cursor.E_RESIZE.equals(cursorEvent) == false) {
                double minHeight = stage.getMinHeight() > (border*2) ? stage.getMinHeight() : (border*2);
                if (Cursor.NW_RESIZE.equals(cursorEvent) == true || Cursor.N_RESIZE.equals(cursorEvent) == true || Cursor.NE_RESIZE.equals(cursorEvent) == true) {
                    if (stage.getHeight() > minHeight || mouseEventY < 0) {
                        stage.setHeight(stage.getY() - mouseEvent.getScreenY() + stage.getHeight());
                        stage.setY(mouseEvent.getScreenY());
                    }
                } else {
                    if (stage.getHeight() > minHeight || mouseEventY + startY - stage.getHeight() > 0) {
                        stage.setHeight(mouseEventY + startY);
                    }
                }
            }

            if (Cursor.N_RESIZE.equals(cursorEvent) == false && Cursor.S_RESIZE.equals(cursorEvent) == false) {
                double minWidth = stage.getMinWidth() > (border*2) ? stage.getMinWidth() : (border*2);
                if (Cursor.NW_RESIZE.equals(cursorEvent) == true || Cursor.W_RESIZE.equals(cursorEvent) == true || Cursor.SW_RESIZE.equals(cursorEvent) == true) {
                    if (stage.getWidth() > minWidth || mouseEventX < 0) {
                        stage.setWidth(stage.getX() - mouseEvent.getScreenX() + stage.getWidth());
                        stage.setX(mouseEvent.getScreenX());
                    }
                } else {
                    if (stage.getWidth() > minWidth || mouseEventX + startX - stage.getWidth() > 0) {
                        stage.setWidth(mouseEventX + startX);
                    }
                }
            }
        }

    }
}
 
Example 10
Source File: Game2048.java    From Game2048FX with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void postInit(Scene scene) {

    String display = Services.get(DisplayService.class)
            .map(service -> service.isTablet() ? "tablet" : "phone")
            .orElse("phone");
    scene.getStylesheets().add(GameManager.class.getResource(display + ".css").toExternalForm());

    GameModel gameModel = Injector.instantiateModelOrService(GameModel.class);
    scene.getRoot().getStyleClass().add(gameModel.getGameMode().toString().toLowerCase());
    gameModel.gameModeProperty().addListener((obs, m, m1) -> {
        scene.getRoot().getStyleClass().remove(m.toString().toLowerCase());
        scene.getRoot().getStyleClass().add(m1.toString().toLowerCase());
    });
    Stage stage = (Stage) scene.getWindow();

    if (Platform.isDesktop()) {
        Services.get(DisplayService.class)
                .ifPresent(service -> {
                    if (service.isTablet()) {
                        // tablet
                        scene.getWindow().setWidth(600);
                        scene.getWindow().setHeight(800);
                    }
                });

        stage.setTitle("2048FX");
        stage.getIcons()
                .add(new Image(GameManager.class.getResourceAsStream("Icon-60.png")));
    }

    AppViewManager.GAME_VIEW.getPresenter().ifPresent(presenter -> {
        gamePresenter = (GamePresenter) presenter;
        gamePresenter.pauseProperty().bind(pause);
        gamePresenter.stopProperty().bind(stop);
    });

    if (Platform.isDesktop() && isARMDevice()) {
        stage.setFullScreen(true);
        stage.setFullScreenExitHint("");
    }

    if (javafx.application.Platform.isSupported(ConditionalFeature.INPUT_TOUCH)) {
        scene.setCursor(Cursor.NONE);
    }
}
 
Example 11
Source File: CursorSupport.java    From gef with Eclipse Public License 2.0 3 votes vote down vote up
/**
 * Sets the given {@link Cursor} as the mouse cursor for the {@link Scene}
 * of the host visual. Note that this method does not store the original
 * mouse cursor.
 *
 * @param cursor
 *            The new mouse {@link Cursor}.
 * @see #storeAndReplaceCursor(Cursor)
 * @see #restoreCursor()
 */
public void setCursor(Cursor cursor) {
	Scene scene = getAdaptable().getRootPart().getVisual().getScene();
	if (cursor != scene.getCursor()) {
		scene.setCursor(cursor);
	}
}