Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resize a JavaFX 3D SubScene?

Tags:

java

javafx

This code will create a 3d scene that is 300x300 large. The viewport won't resize when I resize the containing window/stage.

Parent doesn't have any width or height properties. How do I adjust the size of the Parent and/or SubScene to the changing window size?

like image 804
fho Avatar asked Jul 07 '14 08:07

fho


1 Answers

bind it to the parent

SubScene subscene = new SubScene(root, 1024, 768, true, null);
subscene.setFill(Color.GREY);
subscene.setCamera(camera);
StackPane stackPane = new StackPane();
stackPane.getChildren().add(subscene);
subscene.heightProperty().bind(stackPane.heightProperty());
subscene.widthProperty().bind(stackPane.widthProperty());
like image 191
MitchBroadhead Avatar answered Sep 23 '22 12:09

MitchBroadhead