Java Code Examples for javafx.stage.Stage#setFullScreenExitHint()

The following examples show how to use javafx.stage.Stage#setFullScreenExitHint() . 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: SideScroller.java    From Project-16x16 with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Called by Processing after settings().
 */
@Override
protected PSurface initSurface() {
	surface = (PSurfaceFX) super.initSurface();
	canvas = (Canvas) surface.getNative();
	canvas.widthProperty().unbind(); // used for scaling
	canvas.heightProperty().unbind(); // used for scaling
	scene = canvas.getScene();
	stage = (Stage) scene.getWindow();
	stage.setTitle("Project-16x16");
	stage.setResizable(false); // prevent abitrary user resize
	stage.setFullScreenExitHint(""); // disable fullscreen toggle hint
	stage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH); // prevent ESC toggling fullscreen
	scene.getWindow().addEventFilter(WindowEvent.WINDOW_CLOSE_REQUEST, this::closeWindowEvent);
	return surface;
}
 
Example 2
Source File: PlatformUtils.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Same as setFullScreenWindow but modified to take a javafx Stage Also sets
 * up always on top
 */
public static boolean setFullScreenAlwaysOnTop(Stage stage, boolean fullScreen) {
    if (!Utils.isLinux()) {
        return false;
    }

    stage.setFullScreenExitHint("");
    stage.setFullScreenExitKeyCombination(null);
    stage.setFullScreen(fullScreen);
    stage.setAlwaysOnTop(fullScreen);

    return setFullScreenWindow(getWindowID(stage), fullScreen);
}
 
Example 3
Source File: TrapezoidTest.java    From FXyzLib with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void start(Stage stage) {
    shapeGroup.getChildren().clear();
    generateShapes();
    root.getChildren().add(shapeGroup);
            
    camera = new AdvancedCamera();
    controller = new FPSController();
    
    camera.setNearClip(0.1);
    camera.setFarClip(10000.0);
    camera.setFieldOfView(42);
    camera.setController(controller);
    
    Scene scene = new Scene(new StackPane(root), 1024, 668, true, SceneAntialiasing.BALANCED);
    scene.setCamera(camera);
    scene.setFill(Color.BLACK);
    
    controller.setScene(scene);
    scene.setOnKeyPressed(event -> {
        //What key did the user press?
        KeyCode keycode = event.getCode();
        if(keycode == KeyCode.SPACE) {
            shapeGroup.getChildren().clear();
            generateShapes();                
        }
    });
    
    stage.setTitle("Random Trapezoids!");
    stage.setScene(scene);
    stage.show();
    stage.setFullScreen(false);
    stage.setFullScreenExitHint("");
}
 
Example 4
Source File: OctahedronTest.java    From FXyzLib with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void start(Stage stage) {
    shapeGroup.getChildren().clear();
    generateShapes();
    root.getChildren().add(shapeGroup);
            
    camera = new AdvancedCamera();
    controller = new FPSController();
    
    camera.setNearClip(0.1);
    camera.setFarClip(10000.0);
    camera.setFieldOfView(42);
    camera.setController(controller);
    
    Scene scene = new Scene(new StackPane(root), 1024, 668, true, SceneAntialiasing.BALANCED);
    scene.setCamera(camera);
    scene.setFill(Color.BLACK);
    
    controller.setScene(scene);
    scene.setOnKeyPressed(event -> {
        //What key did the user press?
        KeyCode keycode = event.getCode();
        if(keycode == KeyCode.SPACE) {
            shapeGroup.getChildren().clear();
            generateShapes();                
        }
    });
    
    stage.setTitle("Random Octahedrons!");
    stage.setScene(scene);
    stage.show();
    stage.setFullScreen(false);
    stage.setFullScreenExitHint("");
}
 
Example 5
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 6
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 7
Source File: HeadlessController.java    From ShootOFF with GNU General Public License v3.0 4 votes vote down vote up
public HeadlessController() {
	config = Configuration.getConfig();

	// Configuring cameras may cause us to bail out before doing anything
	// actually useful but we initialize these points first so that we can
	// make more fields immutable (initializing them after a guarded return
	// will make it so the can't be final unless we initialize them all to
	// null).
	final ObservableList<ShotEntry> shotEntries = FXCollections.observableArrayList();

	shotEntries.addListener(new ListChangeListener<ShotEntry>() {
		@Override
		public void onChanged(Change<? extends ShotEntry> change) {
			if (!server.isPresent() || !change.next() || change.getAddedSize() < 1) return;

			for (ShotEntry entry : change.getAddedSubList()) {
				final Shot shot = entry.getShot();
				final Dimension2D d = arenaPane.getArenaStageResolution();
				server.get().sendMessage(new NewShotMessage(shot.getColor(), shot.getX(), shot.getY(),
						shot.getTimestamp(), d.getWidth(), d.getHeight()));
			}
		}
	});

	final CanvasManager canvasManager = new CanvasManager(new Group(), this, "Default", shotEntries);

	final Stage arenaStage = new Stage();
	// TODO: Pass controls added to this pane to the device controlling
	// SBC
	final Pane trainingExerciseContainer = new Pane();

	arenaPane = new ProjectorArenaPane(arenaStage, null, trainingExerciseContainer, this, shotEntries);
	arenaCanvasManager = arenaPane.getCanvasManager();

	arenaStage.setTitle("Projector Arena");
	arenaStage.setScene(new Scene(arenaPane));
	arenaStage.setFullScreenExitHint("");

	camerasSupervisor = new CamerasSupervisor(config);

	final Map<String, Camera> configuredCameras = config.getWebcams();
	final Optional<Camera> camera;

	if (configuredCameras.isEmpty()) {
		camera = CameraFactory.getDefault();
	} else {
		camera = Optional.of(configuredCameras.values().iterator().next());
	}

	if (!camera.isPresent()) {
		logger.error("There are no cameras attached to the computer.");
		return;
	}

	final Camera c = camera.get();

	if (c.isLocked() && !c.isOpen()) {
		logger.error("Default camera is locked, cannot proceed");
		return;
	}

	initializePluginEngine();

	final Optional<CameraManager> manager = camerasSupervisor.addCameraManager(c, this, canvasManager);
	if (manager.isPresent()) {
		final CameraManager cameraManager = manager.get();

		// TODO: Camera views to non-null value to handle calibration issues
		calibrationManager = new CalibrationManager(this, cameraManager, arenaPane, null, this, this);

		arenaPane.setCalibrationManager(calibrationManager);
		arenaPane.toggleArena();
		arenaPane.autoPlaceArena();

		calibrationManager.enableCalibration();
	} else {
		logger.error("Failed to start camera {}", c.getName());
	}
}
 
Example 8
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 9
Source File: CapsuleTest.java    From FXyzLib with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void start(Stage stage) {
    
    Group capsuleGroup = new Group();        
    for (int i = 0; i < 50; i++) {
        Random r = new Random();
        //A lot of magic numbers in here that just artificially constrain the math
        float randomRadius = (float) ((r.nextFloat() * 100) + 25);
        float randomHeight = (float) ((r.nextFloat() * 300) + 75);
        Color randomColor = new Color(r.nextDouble(), r.nextDouble(), r.nextDouble(), r.nextDouble());
        
        Capsule cap = new Capsule(randomRadius, randomHeight, randomColor);               
        cap.setEmissiveLightingColor(randomColor);
        cap.setEmissiveLightingOn(r.nextBoolean());
        cap.setDrawMode(r.nextBoolean() ? DrawMode.FILL : DrawMode.LINE);
        
        double translationX = Math.random() * 1024 * 1.95;
        if (Math.random() >= 0.5) {
            translationX *= -1;
        }
        double translationY = Math.random() * 1024 * 1.95;
        if (Math.random() >= 0.5) {
            translationY *= -1;
        }
        double translationZ = Math.random() * 1024 * 1.95;
        if (Math.random() >= 0.5) {
            translationZ *= -1;
        }
        Translate translate = new Translate(translationX, translationY, translationZ);
        Rotate rotateX = new Rotate(Math.random() * 360, Rotate.X_AXIS);
        Rotate rotateY = new Rotate(Math.random() * 360, Rotate.Y_AXIS);
        Rotate rotateZ = new Rotate(Math.random() * 360, Rotate.Z_AXIS);

        cap.getTransforms().addAll(translate, rotateX, rotateY, rotateZ);
        
        capsuleGroup.getChildren().add(cap);
    }
    
    root.getChildren().add(capsuleGroup);
            
    camera = new AdvancedCamera();
    controller = new FPSController();
    
    camera.setNearClip(0.1);
    camera.setFarClip(10000.0);
    camera.setFieldOfView(42);
    camera.setController(controller);
    
    Scene scene = new Scene(new StackPane(root), 1024, 668, true, SceneAntialiasing.BALANCED);
    scene.setCamera(camera);
    scene.setFill(Color.BLACK);
    
    controller.setScene(scene);
            
    stage.setTitle("Hello World!");
    stage.setScene(scene);
    stage.show();
    stage.setFullScreen(true);
    stage.setFullScreenExitHint("");
}
 
Example 10
Source File: ConeTest.java    From FXyzLib with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void start(Stage stage) {
    
    Group coneGroup = new Group();        
    for (int i = 0; i < 100; i++) {
        Random r = new Random();
        //A lot of magic numbers in here that just artificially constrain the math
        float randomRadius = (float) ((r.nextFloat()*100) + 25);
        float randomHeight = (float) ((r.nextFloat()*300)+ 75);
        int randomDivisions = (int) ((r.nextFloat()*50) + 5);
        Color randomColor = new Color(r.nextDouble(), r.nextDouble(), r.nextDouble(), r.nextDouble());
        
        Cone cone = new Cone(randomDivisions, randomRadius, randomHeight, randomColor);               
        cone.setEmissiveLightingColor(randomColor);
        cone.setEmissiveLightingOn(r.nextBoolean());
        cone.setDrawMode(r.nextBoolean() ? DrawMode.FILL : DrawMode.LINE);
        
        double translationX = Math.random() * 1024;
        if (Math.random() >= 0.5) {
            translationX *= -1;
        }
        double translationY = Math.random() * 1024;
        if (Math.random() >= 0.5) {
            translationY *= -1;
        }
        double translationZ = Math.random() * 1024;
        if (Math.random() >= 0.5) {
            translationZ *= -1;
        }
        Translate translate = new Translate(translationX, translationY, translationZ);
        Rotate rotateX = new Rotate(Math.random() * 360, Rotate.X_AXIS);
        Rotate rotateY = new Rotate(Math.random() * 360, Rotate.Y_AXIS);
        Rotate rotateZ = new Rotate(Math.random() * 360, Rotate.Z_AXIS);

        cone.getTransforms().addAll(translate, rotateX, rotateY, rotateZ);
        
        coneGroup.getChildren().add(cone);
    }
    root.getChildren().add(coneGroup);
    
    camera = new AdvancedCamera();
    controller = new FPSController();
    
    camera.setNearClip(0.1);
    camera.setFarClip(10000.0);
    camera.setFieldOfView(42);
    camera.setController(controller);
    
    Scene scene = new Scene(new StackPane(root), 1024, 668, true, SceneAntialiasing.BALANCED);
    scene.setCamera(camera);
    scene.setFill(Color.BLACK);
    
    controller.setScene(scene);
            
    stage.setTitle("Random Cones!");
    stage.setScene(scene);
    stage.show();
    stage.setFullScreen(false);
    stage.setFullScreenExitHint("");
}