I'm trying to understand (in general terms) the difference between a javafx 2 Scene and Pane. I can get them to work, but I haven't found a clear explanation of what functionality each provides.
The javadoc api defines a Scene as "the container for all content in a scene graph". A Pane (subclass of Region, Parent, Node) is also a container (since widgets like Button) get added to it, rather than to Scene. Apparently Pane handles layout and Scene does not.
Or to put it another way: widgets get added to Panes, a Pane is attached to a Scene, and a Scene is attached to the top level container, Stage. Since Pane does layout and can have properties set such as size, css style, etc., what functionality does the Scene provide? It does appear to be required.
Thanks
Layout panes are containers which are used for flexible and dynamic arrangements of UI controls within a scene graph of a JavaFX application. As a window is resized, the layout pane automatically repositions and resizes the nodes it contains.
stage. Stage , represents a window in a JavaFX desktop application. Inside a JavaFX Stage you can insert a JavaFX Scene which represents the content displayed inside a window - inside a Stage .
The difference between both layouts is positioning of the children and the resizing of resizeable children.
HBox is a subclass of Pane that lays out its children next to each other, in a horizontal row. VBox is a subclass of Pane that lays out its children in vertical column. An HBox might be used as the bottom component in a BorderPane, making it possible to line up several components along the bottom of the border pane.
what functionality does the Scene provide?
Why don't you just compare the Javadoc of both?
E.g.
So you have only one Scene per Stage but possibly several Panes (a Pane is-a Node).
The Scene is the start of, well, the scence graph. But it is more light-weight than a Stage/ Windows, AFAIK.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With