Полноэкранный режим JavaFX - изменение размера элементов в зависимости от размера экрана
Есть ли способ сделать полноэкранный (и, если возможно, изменить размер), чтобы вместо того, чтобы переставить все (на самом деле, это переставить элементы, такие как изменение размера, но на весь экран), чтобы сделать реальный полноэкранный режим? (например, в играх обычно меняют разрешение экрана), чтобы кнопки и текст увеличивались в соответствии с размером экрана / окна.
Также, как я могу удалить сообщение и эффект от нажатия на "УНК» клавиша для выхода из полноэкранного режима?
РЕДАКТИРОВАТЬ: используйте этот способ, чтобы сделать изменяемый размер
@Override public void start(Stage stage) throws Exception{
final int initWidth = 720; //initial width
final int initHeight = 1080; //initial height
final Pane root = new Pane(); //necessary evil
Pane controller = new CtrlMainMenu(); //initial view
controller.setPrefWidth(initWidth); //if not initialized
controller.setPrefHeight(initHeight); //if not initialized
root.getChildren().add(controller); //necessary evil
Scale scale = new Scale(1, 1, 0, 0);
scale.xProperty().bind(root.widthProperty().divide(initWidth)); //must match with the one in the controller
scale.yProperty().bind(root.heightProperty().divide(initHeight)); //must match with the one in the controller
root.getTransforms().add(scale);
final Scene scene = new Scene(root, initWidth, initHeight);
stage.setScene(scene);
stage.setResizable(true);
stage.show();
//add listener for the use of scene.setRoot()
scene.rootProperty().addListener(new ChangeListener(){
@Override public void changed(ObservableValue arg0, Parent oldValue, Parent newValue){
scene.rootProperty().removeListener(this);
scene.setRoot(root);
((Region)newValue).setPrefWidth(initWidth); //make sure is a Region!
((Region)newValue).setPrefHeight(initHeight); //make sure is a Region!
root.getChildren().clear();
root.getChildren().add(newValue);
scene.rootProperty().addListener(this);
}
});
}