I'm writing an JavaFx-Application and want to force the fullscreen. I tried
mainView.getLayout().setOnKeyPressed(event -> {
if(event.getCode() == KeyCode.ESCAPE){
mainView.getStage().setFullScreen(true);
}
});
mainView.getLayout()
returns a StackPane
but that's not a clean solution, when it leaves the fullscreen it automatically switches back to fullscreen. But I want to Catch the LeaveFullScreen and do nothing instead of leave and switch back.