Node
The base class for all GUI elements in a Scene. The nodes form a Scene Graph
(which is a misnomer, because it is a tree
structure, not a graph
), starting at the Scene.root Node.
Each Node may only appear once (i.e. you cannot use the same node in two place, or in two scenes).
See Scene for a Class Diagram.
Inheritors
Properties
The base class Node has no children, so this is an empty list.
If a mouse is clicked on a node, should it request the focus? For controls which can be read-only
(such as TextArea / TextField), we may want to jump over them when pressing Tab
(i.e. focusTraversable = false), but if the are clicked, then they should accept input focus. The user may wish to select, and copy part of the text.
true
when this node has the input focus. Only 1 node per scene has the input focus.
Is this part of the cycle of node that can accept keyboard focus when he user presses the Tab
key (or Shift-Tab
).
On a scale of 0..1, if this Node's parent has extra space compared to its preferred size, how much extra space should be give to this Node relative to its siblings?
The actual height of this node, in LogicalPixels.
Supposedly unique identifier (or blank). However, it is up to the application developer to ensure the id is unique.
The position of this Node, relative to its parent Node in LogicalPixels. The position and size of Nodes are assigned by their parent in layout, using setChildBounds.
The position of this Node, relative to its parent Node in LogicalPixels. The position and size of Nodes are assigned by their parent in layout, using setChildBounds.
When not null, nodeMaxHeight is ignored.
When not null, nodeMaxWidth is ignored.
When not null, nodeMinHeight is ignored.
When not null, nodeMinWidth is ignored.
When not null, nodePrefHeight is ignored.
When not null, nodePrefWidth is ignored.
Similar to styles, but used for temporary styles, such as :hover
.
An ObservableOptionalFont, whose value is Theme.defaultFont. To access this is quite convoluted, because both Node.scene and Scene.theme can change.
The X position of the Node relative to the top left of the window in LogicalPixels. The position and size of Nodes are assigned by their parent in layout, using setChildBounds.
The Y position of the Node relative to the top left of the window in LogicalPixels. The position and size of Nodes are assigned by their parent in layout, using setChildBounds.
On a scale of 0..1, if this Node's parent has extra space compared to its preferred size, how much should this node shrink by compared to its siblings.
Used by the Theme to determine how this node should be styled. Similar in concept to CSS's class
attribute.
Defines a popup that appears when the user hover the mouse over this node for a period of time. Typically, containing help text and a KeyCombination.displayText (if this node can be activated using a keyboard shortcut).
When false
, this node will not appear in the scene, and will not take up any spaces.
The actual width of this node, in LogicalPixels.
Functions
Consider using these convenience functions instead : onMousePressed, onMouseReleased, onPopupTrigger, onMouseClicked, onMouseDragged, onMouseMoved, onMouseEntered, onMouseExited, onKeyPressed, onKeyReleased.
Converts em
units to LogicalPixels.
@return this
if none of my children are at sceneX,sceneY. Otherwise, the child (or one of its ancestors).
Checks this node, and all descendants for a matching id. @return The first node which matches, or null if none match.
Tests each node from this one to the root node. When filter hold true, that node is returned, stopping the iteration. If none are found, returns null.
Applies a block of code on this node, and all of its ancestors, starting at the root node and working downwards to this node.
Applies a block of code on this node, and all of its ancestors, starting at this node and working up to the root node.
The default implementation returns NO_MAXIMUM (an arbitrary large number : 100,000).
The default implementation returns NO_MAXIMUM (an arbitrary large number : 100,000).
Each subclass of node can determine the minimum width it requires. This can be overridden on an ad-hoc basis using overrideMinHeight. The default implementation returns 0.
Each subclass of node can determine the minimum width it requires. This can be overridden on an ad-hoc basis using overrideMinWidth. The default implementation returns 0.
Each subclass of node can determine its preferred height. As most nodes are composed of smaller nodes, this is typically calculated using evalPrefWidth of the child nodes, with extra added for spacing, padding and borders.
Each subclass of node can determine its preferred width. As most nodes are composed of smaller nodes, this is typically calculated using evalPrefWidth of the child nodes, with extra added for spacing, padding and borders.
A more convenient version of addEventHandler for EventType.KEY_PRESSED.
A more convenient version of addEventHandler for EventType.KEY_RELEASED.
A more convenient version of addEventHandler for EventType.KEY_TYPED.
A more convenient version of addEventHandler for EventType.MOUSE_CLICKED.
A more convenient version of addEventHandler for EventType.MOUSE_DRAGGED.
A more convenient version of addEventHandler for EventType.MOUSE_ENTERED.
A more convenient version of addEventHandler for EventType.MOUSE_EXITED.
A more convenient version of addEventHandler for EventType.MOUSE_MOVED.
A more convenient version of addEventHandler for EventType.MOUSE_PRESSED.
A more convenient version of addEventHandler for EventType.MOUSE_RELEASED.
handler will fire when the secondary mouse button is pressed/released depending on the platform.
A more convenient version of addEventHandler for EventType.SCROLL.
Adds a style to Node.pseudoStyle
Adds or removes the pseudoStyle depending on test. See Node.pseudoStyles
When test is true
, trueStyle is added, and falseStyle is removed from Node.pseudoStyles.
Informs all ancestors that the pref/min/max size of this node has changed, and therefore layoutChildren needs to be called again before the scene is rendered. Cached data, such as prefWidth/height should be invalidated.
Informs that this node needs to be redrawn. Currently, this causes the whole scene to be redrawn.
Adds a style to Node.styles