Set scene width and height

Chika picture Chika · Jan 9, 2012 · Viewed 27.1k times · Source

I have been trying to set the scene's width and height outside of the constructor and it's been to no avail. After looking through the Scene API I saw a method that lets you get the height and width respectively but not one to set the method.. :s (design flaw maybe).

After further research I came across the SceneBuilder and found methods that could modify the height and width. However, I do not know how to apply it to a scene object already created or how to create a SceneBuilder object that could be used in place of the scene object.

Answer

Sergey Grinev picture Sergey Grinev · Jan 9, 2012

Once you created Scene and assigned it to the Stage you can use Stage.setWidth and Stage.setHeight to change both stage and scene sizes simultaneously.

SceneBuilder can't be applied to an already created object, it can only be used for the scene creation.