Question on scene.setRoot vs stage.setScene

Paul Johnson paul at bigtheta.co.uk
Mon May 18 08:39:04 UTC 2020


I'm currently evaluating JavaFX for a project and I'm pretty confused by 
recommendations on stack-overflow and also by the JavaFX archetype on 
Maven which seem to suggest that when altering content on a stage one 
should switch out the scene graphs root node instead of replacing the 
the current scene, I have yet to find an explanation as to why that 
should be the case.

Does this not mean that the theatre metaphor is fundamentally broken?

This theatre has a primary stage, the show has only one scene to act out 
on the primary stage but the props and actors of the scene are changed 
so radically that it appears to the audience that there are multiple 
scenes taking place.

I have noticed that calling stage.setScene appears to resize the stage 
which also seems to break the metaphor, presumably those dressing the 
stage / acting should adapt the setup to the stage rather than resizing 
the stage to accommodate the scene.

Kind regards


Paul



More information about the openjfx-discuss mailing list