연승현 :
I want to make the function to return to the full-screen mode after pressing ESC to exit the full-screen mode.
Is there any method to return to full-screen?
for example, to execute the full screen mode, I used the method as below
@Override
public void init(Controller controller) {
sound.backgroundMusic();
menuButtons = new ArrayList<>();
createSubScenes(controller);
createButtons(controller);
createBackground();
createLogo();
controller.setScene(mainScene);
}
public void setScene(Scene scene) {
Platform.runLater(() -> stage.setScene(scene));
Platform.runLater(() -> stage.setFullScreen(true));
}
in the stage, when I press ESC, the stage exits to the full screen. enter image description here
and then in this stage, I want to hope to return to the full screen mode.
Amarildo :
Prevent from going out of full-screen with ESC (or any other key) using:
stage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH);
If you are not in full-screen, create a listener or method to go to full-screen executing:
stage.setFullScreen(true);