Scene
There is a 1:1 relationship between a window
and a Stage, and at any moment in time there is also a 1:1 relationship between Stage and Scene. However, it is possible to replace a Stage's scene. In most cases though, a stage keeps the same scene.
A Scene has a root node, which is the top Node of the scene graph
. For a typical application, this is a BorderPane, with a MenuBar
and ToolBar
s at the top
, and the application's main content in the center
.
If the width or height of a new scene is <= 0, then when the scene is shown, the scene's prefWidth
\ prefHeight
will be used. e.g. If you want a scene 100 LogicalPixels high, but want the use its pref width, then
myScene = Scene( myRootNode, 0f, 100f )
Class Diagram
╭╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╮ ┏━━━━━━━━━━━━━━━━┓
┆ Stage ┆ ┃ Scene ┃ ┏━━━━━━━━━━━━━━━┓
┆ scene ├───────────┨ stage ┃ ┃ Theme ┃
┆ resizable ┆ ┃ theme ┠──────────────▶┃ ┃
┆ maximized ┆ ┃ root ┠───────┐ ┃ ┃
┆ minimized ┆ ┃ requestLayout ┃ │ ┗━━━━━━━━━━━━━━━┛
┆ focused ┆ ┃ requestRedraw ┃ │
┆ title ┆ ┃ focusOwner ┠────┐ │
┆ closing ┆ ┃ width ┃ │ │ ┌───────────────────────┐
┆ onCloseRequested ┆ ┃ height ┃ │ │ │ Node │
┆ onClosed ┆ ┃ ... ┃ │ └───▶│ scene │
┆ cursor ┆ ┗━━━━━━━━━━━━━━━━┛ │ │ children : List ├───┐
╰╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╯ │ │ parent : Node? │◆──┘
△ └──────▶│ │
│ │ │
┌──────┴────────┐ │ localX,Y │
│ StageBase │ │ sceneX,Y │
│ │ │ │
│ regularStage ├──────────────┐ │ requestLayout() │
└───────────────┘ │ │ requestRedraw() │
△ │ │ │
│ │ │-draw() │
┌──────────┴────────┐ │ │-drawChildren() │
┏━━━━━━━━━━┷━━━━━━━┓ ┏━━━━━━┷━━━━━━━━━┓ │ │-layoutChildren() │
┃ OverlayStage ┃ ┃ RegularStage ┃◀───┘ │ │
┃ parent : Stage ┃ ┃ scale : Float ┃ │ ... │
┃ stageType ┃ ┃ window ┃ └───────────────────────┘
┗━━━━━━━━━━━━━━━━━━┛ ┗━━━━━━━━━━━━━━━━┛
Created with Blokart
Constructors
Properties
The height of the scene in LogicalPixels. In most cases, root's height == Scene.height. However, if the user shrinks the window smaller than the root's minHeight, then root is given it's minHeight, and the bottom will not be visible.
Setting this to true
will cause layout to be called.
Setting this to true
will cause the scene to be redrawn.
Setting this to true
will cause the entire scene to be re-styled
Initially bound to Application.defaultThemeProperty, whose value is Tantalum.theme.
The width of the scene in LogicalPixels. In most cases, root's width == Scene.width. However, if the user shrinks the window smaller than the root's minWidth, then root is given it's minWidth, and the right hand side will not be visible.
Functions
Equivalent to pressing Shift-TAB, to move the focus to the previous node.
Give the input focus
to node. Key events KeyEvent and KeyTypedEvent will be directed at node. See Node.onKeyPressed and Node.onKeyTyped.