How to change scene when in fullscreen in JavaFX and avoid "Press ESC to exit fullscreen" message
Asked Answered
W

3

16

How is it possible to change scene of fullscreen window and avoid to show "Press ESC to exit fullscreen" message?

I'm building fullscreen desktop application (touchscreen kiosk) so I can show this message at the beginning, but now always when user changes scene.

There are two problems:

  1. When in fullscreen and scene is changed, window size is reduced. Solution is to toggle fullscreen, but there is that message shown. (Change scene in full screen JavaFX)

  2. "Press ESC.." message cannot be disable due to security reasons (https://forums.oracle.com/forums/thread.jspa?threadID=2287258)

Thanks.

Weltschmerz answered 23/5, 2013 at 12:8 Comment(0)
T
39

JavaFX 8 has solved this problem with the addition of the following 2 methods:

If you set the exit key combination to KeyCombination.NO_MATCH the pop-up message will be disabled completely.

Teletype answered 5/12, 2013 at 13:3 Comment(0)
M
3

on 2. there's going to be a new feature in JavaFX8 to turn that warning of. The current proposal is that there's going to be a command line option. You can see the discussion on the openjfx mailing list (http://markmail.org/search/?q=+javafx.Stage.fullScreenWarning%3Dfalse#query:%20javafx.Stage.fullScreenWarning%3Dfalse+page:1+mid:ptqpgut2vvvhgkip+state:results)

Moulton answered 23/5, 2013 at 12:44 Comment(2)
Thanks. It will be released on 2nd June? Available there - jdk8.java.net/download.html ?Weltschmerz
why on 2nd june? Java8 is delayed until March 2014Moulton
A
0
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.input.KeyCombination;

public class GameApplication extends Application{
    @Override
    public void start(Stage stage){
        StackPane stackPane=new StackPane();
        Scene scene=new Scene(stackPane,500,500);
        stage.setScene(scene);
        stage.setTitle("Title");
        //Fullscreen
        stage.setFullScreen(true);
        //We don't want to exit the fullscreen when keys are pressed
        stage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH);
        //We are adding a change listener to lock the application in full
        //screen mode only
        stage.fullScreenProperty().addListener(new ChangeListener<Boolean>() {

            @Override
            public void changed(ObservableValue<? extends Boolean> observable,
                    Boolean oldValue, Boolean newValue) {
                if(newValue != null && !newValue.booleanValue())
                    stage.setFullScreen(true);
            }
        });
        stage.show();
    }
    //main method
    public static void main(String ...$){
        launch($);
    }
}
Arnitaarno answered 1/9, 2021 at 6:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.