0

A stage in javafx requires exactly one scene, and a scene requires exactly one root node.
So I want to know what's the main role of the scene? It seems like a scene connects two sides that can be connected directly without an intermediate.
I want juste to understand the logic. Thank you.

c0der
  • 18,467
  • 6
  • 33
  • 65
Bell Bell
  • 9
  • 4
  • 4
    Just read the Javadocs and look at the properties belonging to a `Scene`. E.g. a `Scene` has a list of stylesheets, so if you change the root of a scene, the same stylesheets will be applied to the new root. (Conversely, if you change the scene entirely, you'd get a new set of stylesheets.) There are other differences between changing the scene and changing the root of the scene, see e.g. https://stackoverflow.com/questions/35673607/javafx-changing-scenes-on-fullscreen-mode – James_D Jun 11 '20 at 14:20

1 Answers1

1

Stage represents a native system window. Scene is the content of this window with JavaFX controls, nodes, stylesheets, etc.

You can change Scenes inside a Stage during your UI workflow without a need to create a new system window each time.

Sergey Grinev
  • 34,078
  • 10
  • 128
  • 141