Scene

class Scene(root: Node, width: Float = 0.0f, height: Float = 0.0f)

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 ToolBars 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

Link copied to clipboard
constructor(root: Node, width: Float = 0.0f, height: Float = 0.0f)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

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.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Setting this to true will cause layout to be called.

Link copied to clipboard
Link copied to clipboard

Setting this to true will cause the scene to be redrawn.

Link copied to clipboard
Link copied to clipboard

Setting this to true will cause the entire scene to be re-styled

Link copied to clipboard
var root: Node
Link copied to clipboard
Link copied to clipboard
var stage: Stage?
Link copied to clipboard
Link copied to clipboard

Initially bound to Application.defaultThemeProperty, whose value is Tantalum.theme.

Link copied to clipboard

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.

Link copied to clipboard

Functions

Link copied to clipboard
fun dump(borders: Boolean = false, size: Boolean = false, filter: (Node) -> Boolean = { it.visible })
Link copied to clipboard
fun findDeepestNodeAt(sceneX: Float, sceneY: Float): Node?
Link copied to clipboard
Link copied to clipboard
fun focusNext()

Equivalent to pressing the TAB key, to advance the focus to the next node.

Link copied to clipboard

Equivalent to pressing Shift-TAB, to move the focus to the previous node.

Link copied to clipboard
fun requestFocus(node: Node, useFocusTraversable: Boolean = false)

Give the input focus to node. Key events KeyEvent and KeyTypedEvent will be directed at node. See Node.onKeyPressed and Node.onKeyTyped.

Link copied to clipboard
open override fun toString(): String