Overview
Base class for container nodes. A container is a javafx.scene.Parent node which is Resizable and performs layout on its children, which are by default defined by its content sequence.
A Container subclass should override the doLayout function to position
and resize (if appropriate) its managed content nodes in accordance with its
own layout strategy given its current width and height values.
Note that doLayout
is called automatically by the scene graph while
executing a top-down layout pass and it should not be invoked directly by a
container subclass.
In addition to overriding doLayout
, a Container subclass should also
override getPrefWidth and getPrefHeight to return appropriate
values given its current state. This is critical to ensure that the parent
of the Container resizes it appropriately during layout. See Resizable
for details on additional functions that may be overridden if the Container
defaults are not sufficient.
Containers position nodes by setting layoutX
/layoutY
and
do not alter translateX
/translateY
, which are reserved for
adjustments and animation. Containers also resize Resizable content
by typically querying their min/pref/max/fill size preferences and then
setting the child's width and height accordingly. To make these operations
easier, the Container class provides a number of script-level utility functions
that handle details such as Resizable-vs-not, subtracting layoutBounds.minX/Y, etc:
getManaged(content:Node[]):Node[]
resizeNode(node:Node, width:Number, height:Number):Boolean
positionNode(node:Node, x:Number, y:Number):Void
layoutNode(node:Node, x:Number, y:Number, width:Number, height:Number):Boolean
A Container may choose to honor LayoutInfo constraints set on a
child via the node's layoutInfo
variable, though it doesn't have to.
It is strongly recommended that if the Container will be used for general
purpose layout that it at least honor any min/pref/max size overrides set
by the application using LayoutInfo
. Container provides many script-level
utility functions to make it easier to deal with LayoutInfo
:
getNodeMinWidth(node:Node):Number
/getNodeMinHeight(node:Node):Number
getNodePrefWidth(node:Node):Number
/getNodePrefHeight(node:Node):Number
getNodeMaxWidth(node:Node):Number
/getNodeMaxHeight(node:Node):Number
getNodeHPos(node:Node):HPos
/getNodeVPos(node:Node):VPos
layoutNode(node:Node, areaX:Number, areaY:Number, areaW:Number, areaH:Number, areaBaseline:Number, hfill:Boolean, vfill:Boolean, hpos:HPos, vpos:VPos, snapToPixel:Boolean):Boolean
Profile: common
Script Variable Summary
access | name | type | Can Read | Can Init | Can Write | Default Value | description |
---|
Variable Summary
access | name | type | Can Read | Can Init | Can Write | Default Value | description |
---|---|---|---|---|---|---|---|
public | content | Node[] | empty |
A sequence of child A sequence of child See the class documentation for Node for scene graph structure restrictions on setting a Container's content sequence. If these restrictions are violated by a change to the content sequence, the change is ignored and the previous value of the content sequence is restored. Throws: Profile: common |
|||
public | snapToPixel | Boolean |
Inherited Variables
javafx.scene.Parent
access | name | type | Can Read | Can Init | Can Write | Default Value | description |
---|---|---|---|---|---|---|---|
protected | children | Node[] | subclass | subclass | subclass | empty |
A sequence of child A sequence of child See the class documentation for Node for scene graph structure restrictions on setting a Parent's children sequence. If these restrictions are violated by a change to the children sequence, the change is ignored and the previous value of the child sequence is restored. Throws: Profile: common |
public-read protected | needsLayout | Boolean | subclass | subclass |
Indicates that this Node and its subnodes requires a layout pass on the next pulse. |
javafx.scene.Node
access | name | type | Can Read | Can Init | Can Write | Default Value | description |
---|---|---|---|---|---|---|---|
public | blocksMouse | Boolean | false |
If If Profile: common |
|||
public-read | boundsInLocal | Bounds |
The rectangular bounds of this The rectangular bounds of this
Note that this method does not take the node's visibility into account;
the test is based on the geometry of this This variable will always be a non-null value. Note that boundsInLocal is automatically recomputed whenever the geometry of a node changes. For this reason, it is an error to bind any of these values in a node to an expression that depends upon this variable. For example, the "x" or "y" variables of a shape should never be bound to boundsInLocal for the purpose of positioning the node. Profile: common |
||||
public-read | boundsInParent | Bounds |
The rectangular bounds of this The rectangular bounds of this
The resulting bounds will be conceptually in the coordinate space of the
Note that this method does not take the node's visibility into account;
the test is based on the geometry of this This variable will always be a non-null value. Note that boundsInParent is automatically recomputed whenever the geometry of a node changes, or when any of the following change: the transforms sequence, the translateX, translateY, layoutX, layoutY, scaleX, scaleY, or rotate variable. For this reason, it is an error to bind any of these values in a node to an expression that depends upon this variable. For example, the "x" or "y" variables of a shape, or translateX, translateY should never be bound to boundsInParent for the purpose of positioning the node. Profile: common |
||||
public | cache | Boolean | false |
A performance hint to the system to indicate that this A performance hint to the system to indicate that this
See Also:
Profile: common |
|||
public | cacheHint | CacheHint | CacheHint.DEFAULT |
Additional hint for controlling bitmap caching. Additional hint for controlling bitmap caching. Under certain circumstances, such as animating nodes that are very expensive to render, it is desirable to be able to perform transformations on the node without having to regenerate the cached bitmap. An option in such cases is to perform the transforms on the cached bitmap itself.
This technique can provide a dramatic improvement to animation
performance, though may also result in a reduction in visual quality.
The It is possible to enable the cacheHint only at times when your node is animating. In this way, expensive nodes can appear on screen with full visual quality, yet still animate smoothly. Example:
Note that cacheHint is only a hint to the system. Depending on
the details of the node or the transform, this hint may be ignored.
If
See Also:
Profile: common |
|||
public | clip | Node | null |
Specifies a Specifies a For example, you can use an javafx.scene.image.ImageView Node as a mask to represent the Clip. Or you could use one of the geometric shape Nodes such as javafx.scene.shape.Rectangle or javafx.scene.shape.Circle. Or you could use a javafx.scene.text.Text node to represent the Clip. See the class documentation for Node for scene graph structure restrictions on setting the clip. If these restrictions are violated by a change to the clip variable, the change is ignored and the previous value of the clip variable is restored. Note: this is a conditional feature. See ConditionalFeature.SHAPE_CLIP for more information. nullProfile: common conditional shape_clip |
|||
public | cursor | Cursor | null |
Defines the mouse cursor for this Defines the mouse cursor for this Profile: common |
|||
public | disable | Boolean | false |
Sets the individual disabled state of this Sets the individual disabled state of this Profile: common |
|||
public-read | disabled | Boolean | false |
Indicates whether or not this Indicates whether or not this
A disabled
A disabled Profile: common |
|||
public | effect | Effect | null |
Specifies an effect to apply to this Specifies an effect to apply to this Note: this is a conditional feature. See ConditionalFeature.EFFECT for more information. nullProfile: common conditional effect |
|||
public-read protected | focused | Boolean | subclass | subclass | false |
Indicates whether this Indicates whether this Profile: common |
|
public | focusTraversable | Boolean | false |
Specifies whether this Specifies whether this Profile: common |
|||
public-read protected | hover | Boolean | subclass | subclass | false |
Whether or not this Whether or not this NOTE: the current implementation of hover relies on mouse enter and exit events to determine whether this Node is in the hover state; this means that this feature is currently supported only on systems that have a mouse. Future implementations may provide alternative means of supporting hover. falseProfile: common |
|
public | id | String | empty string |
The id of this The id of this Profile: common |
|||
public-read protected | layoutBounds | Bounds | subclass | subclass |
The rectangular bounds that should be used for layout calculations on
this The rectangular bounds that should be used for layout calculations on
this
See javafx.scene.shape.Shape, javafx.scene.text.Text,
Group, and javafx.scene.layout.Resizable for detailed
descriptions on how
Note that the layoutX, layoutY, translateX, and
translateY variables are not included in the layoutBounds.
This is important because layout code must first determine the current
size and location of the
Because the computation of layoutBounds is often tied to a node's
geometric variables, it is an error to bind any such variables to an
expression that depends upon Profile: common |
||
public | layoutInfo | LayoutInfoBase |
Hook for node-specific layout information used by layout containers. Hook for node-specific layout information used by layout containers. If the node is not a child of a container which supports layout info, this variable will be ignored.
Note that layoutInfo object literals may be shared across nodes, which
means altering the vars on a |
||||
public | layoutX | Number | 0 |
Defines the x coordinate of the translation that is added to this Defines the x coordinate of the translation that is added to this For example, if
Failure to subtract
The node's final translation will be computed as
If the node is managed and has a javafx.scene.layout.Container
as its parent, then the container will set Profile: common |
|||
public | layoutY | Number | 0 |
Defines the y coordinate of the translation that is added to this Defines the y coordinate of the translation that is added to this For example, if
Failure to subtract
The node's final translation will be computed as
If the node is managed and has a javafx.scene.layout.Container
as its parent, then the container will set Profile: common |
|||
public | managed | Boolean | true |
Defines whether or not this node's layout will be managed by it's parent. Defines whether or not this node's layout will be managed by it's parent. Each parent class follows a strategy for laying out managed children during the scene's layout pass:
If a Parent node is unmanaged, then it will act as a root for layout, which means that layout requests beneath it will cause only the branch rooted by the parent node to be relayed out. true |
|||
public | onKeyPressed | function(:KeyEvent):Void |
Defines a function to be called when this |
||||
public | onKeyReleased | function(:KeyEvent):Void |
Defines a function to be called when this |
||||
public | onKeyTyped | function(:KeyEvent):Void |
Defines a function to be called when this |
||||
public | onMouseClicked | function(:MouseEvent):Void |
Defines a function to be called when a mouse button has been clicked
(pressed and released) on this |
||||
public | onMouseDragged | function(:MouseEvent):Void |
Defines a function to be called when a mouse button is pressed
on this |
||||
public | onMouseEntered | function(:MouseEvent):Void |
Defines a function to be called when the mouse enters this |
||||
public | onMouseExited | function(:MouseEvent):Void |
Defines a function to be called when the mouse exits this |
||||
public | onMouseMoved | function(:MouseEvent):Void |
Defines a function to be called when mouse cursor moves within
this |
||||
public | onMousePressed | function(:MouseEvent):Void |
Defines a function to be called when a mouse button
has been pressed on this |
||||
public | onMouseReleased | function(:MouseEvent):Void |
Defines a function to be called when a mouse button
has been released on this |
||||
public | onMouseWheelMoved | function(:MouseEvent):Void |
Defines a function to be called when the mouse scroll wheel has moved. |
||||
public | opacity | Number | 1.0 |
Specifies how opaque (that is, solid) the Specifies how opaque (that is, solid) the A visible node with any opacity setting still receives mouse events and can receive keyboard focus. For example, if you want to have a large invisible rectangle overlay all Nodes in the scene graph in order to intercept mouse events but not be visible to the user, you could create a large Rectangle that had an opacity of 0%. Opacity is specified as a value between 0 and 1. Values less than 0 or greater than 1 are clipped to 0 and 1 respectively. On some platforms ImageView might not support opacity variable. 1.0Profile: common |
|||
public-read package | parent | Parent | null |
The parent of this The parent of this Profile: common |
|||
public | pickOnBounds | Boolean | false |
Defines how the picking computation is done for this node when
triggered by a Defines how the picking computation is done for this node when
triggered by a Profile: common |
|||
public-read protected | pressed | Boolean | subclass | subclass | false |
Whether or not the Whether or not the Profile: common |
|
public | rotate | Number | 0.0 |
Defines the angle of rotation about the Defines the angle of rotation about the This rotation factor is not included in layoutBounds by default, which makes it ideal for rotating the entire node after all effects and transforms have been taken into account. The pivot point about which the rotation occurs is the center of the untransformed layoutBounds.
Note that because the pivot point is computed as the center of this
Profile: common |
|||
public | rotationAxis | Point3D | Rotate.Z_AXIS |
Defines the axis of rotation of this Defines the axis of rotation of this Note: this is a conditional feature. See ConditionalFeature.SCENE3D for more information. Rotate.Z_AXISProfile: common conditional scene3d |
|||
public | scaleX | Number | 1.0 |
Defines the factor by which coordinates are scaled about the center of the
object along the X axis of this Defines the factor by which coordinates are scaled about the center of the
object along the X axis of this This scale factor is not included in layoutBounds by default, which makes it ideal for scaling the entire node after all effects and transforms have been taken into account. The pivot point about which the scale occurs is the center of the untransformed layoutBounds. 1.0Profile: common |
|||
public | scaleY | Number | 1.0 |
Defines the factor by which coordinates are scaled about the center of the
object along the Y axis of this Defines the factor by which coordinates are scaled about the center of the
object along the Y axis of this This scale factor is not included in layoutBounds by default, which makes it ideal for scaling the entire node after all effects and transforms have been taken into account. The pivot point about which the scale occurs is the center of the untransformed layoutBounds. 1.0Profile: common |
|||
public | scaleZ | Number | 1.0 |
Defines the factor by which coordinates are scaled about the center of the
object along the Z axis of this Defines the factor by which coordinates are scaled about the center of the
object along the Z axis of this This scale factor is not included in layoutBounds by default, which makes it ideal for scaling the entire node after all effects and transforms have been taken into account. The pivot point about which the scale occurs is the center of the rectangular bounds formed by taking boundsInLocal and applying all the transforms in the transforms[] sequence. Note: this is a conditional feature. See ConditionalFeature.SCENE3D for more information. 1.0Profile: common conditional scene3d |
|||
public-read package | scene | Scene | null |
The Scene that this The Scene that this Profile: common |
|||
public | style | String | empty string |
A string representation of the CSS style associated with this specific Node. A string representation of the CSS style associated with this specific Node. This is analogous to the "style" attribute of an HTML element. Note that, like the HTML style attribute, this variable contains style properties and values and not the selector portion of a style rule. Parsing this style might not be supported on some limited platforms. It is recommended to use a standalone CSS file instead. empty stringProfile: common |
|||
public | styleClass | String | empty string |
A String identifier which can be used to logically group Nodes, specifically for an external style engine. A String identifier which can be used to logically group Nodes, specifically for an external style engine. This variable is analogous to the "class" attribute on an HTML element. empty stringProfile: common |
|||
public | transforms | Transform[] | empty |
Defines the sequence of javafx.scene.transform.Transform objects
to be applied to this Defines the sequence of javafx.scene.transform.Transform objects
to be applied to this Profile: common |
|||
public | translateX | Number | 0 |
Defines the x coordinate of the translation that is added to this Defines the x coordinate of the translation that is added to this
The node's final translation will be computed as layoutX + This variable can be used to alter the location of a node without disturbing its layoutBounds, which makes it useful for animating a node's location. 0Profile: common |
|||
public | translateY | Number | 0 |
Defines the y coordinate of the translation that is added to this Defines the y coordinate of the translation that is added to this
The node's final translation will be computed as layoutY + This variable can be used to alter the location of a node without disturbing its layoutBounds, which makes it useful for animating a node's location. 0Profile: common |
|||
public | translateZ | Number | 0 |
Defines the Z coordinate of the translation that is added to the
transformed coordinates of this Defines the Z coordinate of the translation that is added to the
transformed coordinates of this This variable can be used to alter the location of a Node without disturbing its layout bounds, which makes it useful for animating a node's location. Note: this is a conditional feature. See ConditionalFeature.SCENE3D for more information. 0Profile: common conditional scene3d |
|||
public | visible | Boolean | true |
Specifies whether this Specifies whether this Profile: common |
javafx.scene.layout.Resizable
access | name | type | Can Read | Can Init | Can Write | Default Value | description |
---|---|---|---|---|---|---|---|
public | height | Number |
The The
If an application needs to control the height of a Resizable node, it
should override its preferred height using
Profile: common |
||||
public | width | Number |
The The
If an application needs to control the width of a Resizable node, it
should override its preferred width using
Profile: common |
javafx.scene.text.TextOffsets
access | name | type | Can Read | Can Init | Can Write | Default Value | description |
---|---|---|---|---|---|---|---|
public-read protected | baselineOffset | Number | subclass | subclass |
The 'alphabetic' (or 'roman') baseline offset from the node's layoutBounds.minY location. |
Script Function Summary
- public getManaged(content: Node[]) : Node[]
-
Utility function which returns the sequence of nodes within the content whose layout should be managed by its parent.
Utility function which returns the sequence of nodes within the content whose layout should be managed by its parent. See javafx.scene.Node#managed.
-
Parameters
- content
-
Returns
- Node[]
- public bound getNodeBaselineOffset(node: Node) : Number
-
Utility function which returns the baseline offset of the
Node
if it implements javafx.scene.text.TextOffsets, otherwise returns layoutBounds.height.Utility function which returns the baseline offset of the
Node
if it implements javafx.scene.text.TextOffsets, otherwise returns layoutBounds.height.-
Parameters
- node
-
Returns
- Number
- public getNodeHFill(node: Node, fallback: Boolean) : Boolean
-
Utility function which returns the horizontal fill constraint of the
Node
which defines whether the node should be sized larger than its preferred width (up to its maximum) if it's Resizable and its layout area has additional horizontal space.Utility function which returns the horizontal fill constraint of the
Node
which defines whether the node should be sized larger than its preferred width (up to its maximum) if it's Resizable and its layout area has additional horizontal space.If the node has a non-null
layoutInfo
wherehfill
is set, then that value is returned, else if the node isResizable
then itsgetHFill()
is returned, else the fallback is returned.-
Parameters
- node
- fallback
-
Returns
- Boolean
- public getNodeHGrow(node: Node) : Priority
-
Utility function which returns the horizontal grow priority of the
Node
, which defines whether the node's layout area should be allocated additional horizontal space if a container has additional horizontal space and multiple nodes are competing for it.Utility function which returns the horizontal grow priority of the
Node
, which defines whether the node's layout area should be allocated additional horizontal space if a container has additional horizontal space and multiple nodes are competing for it.If the node has a non-null
layoutInfo
wherehgrow
is set, then that value is returned, else if the node is Resizable then itsgetHGrow()
is returned, elsePriority.NEVER
is returned.-
Parameters
- node
-
Returns
- Priority
- public getNodeHPos(node: Node, fallback: HPos) : HPos
-
Utility function which returns the horizontal layout position of the
Node
which defines how the node should be horizontally aligned within its layout space if the width of the layout space is greater than the layout bounds width of the node.Utility function which returns the horizontal layout position of the
Node
which defines how the node should be horizontally aligned within its layout space if the width of the layout space is greater than the layout bounds width of the node.If the node has a non-null
layoutInfo
wherehpos
is set, then that value is returned, else the fallback value is returned.-
Parameters
- node
- fallback
-
Returns
- HPos
- public getNodeHShrink(node: Node) : Priority
-
Utility function which returns the horizontal shrink priority of the
Node
, which defines whether the node's layout area should shrink if the container's width is less than its preferred width and multiple nodes are competing for that horizontal space.Utility function which returns the horizontal shrink priority of the
Node
, which defines whether the node's layout area should shrink if the container's width is less than its preferred width and multiple nodes are competing for that horizontal space.If the node has a non-null
layoutInfo
wherehshrink
is set, then that value is returned, else if the node is Resizable then itsgetHShrink()
is returned, elsePriority.NEVER
is returned.-
Parameters
- node
-
Returns
- Priority
- public getNodeMargin(node: Node) : Insets
-
Utility function which returns the margin constraint of the
Node
if it was set on a LayoutInfo on the node'slayoutInfo
variable, else returns an Insets with top, right, bottom, and left equal to 0.Utility function which returns the margin constraint of the
Node
if it was set on a LayoutInfo on the node'slayoutInfo
variable, else returns an Insets with top, right, bottom, and left equal to 0.-
Parameters
- node
-
Returns
- Insets
- public getNodeMaxHeight(node: Node) : Number
-
Utility function which returns the maximum height of the
Node
.Utility function which returns the maximum height of the
Node
. Layout containers should not set the height of a Resizable node to a value greater than this value.If the node is Resizable, the function first checks for a
maxHeight
value set on the node'slayoutInfo
variable (such a constraint indicates that the application overrode the Resizable's intrinsic maximum height). If no override exists, it returns the Resizable's intrinsic maximum height by callinggetMaxHeight
.If the node is not
Resizable
, returns its current layout bounds height.-
Parameters
- node
-
Returns
- Number
- public getNodeMaxWidth(node: Node) : Number
-
Utility function which returns the maximum width of the
Node
.Utility function which returns the maximum width of the
Node
. Layout containers should not set the width of a Resizable node to a value greater than this value.If the node is Resizable, the function first checks for a
maxWidth
value set on the node'slayoutInfo
variable (such a constraint indicates that the application overrode the Resizable's intrinsic maximum width). If no override exists, it returns the Resizable's intrinsic maximum width by callinggetMaxWidth
.If the node is not
Resizable
, returns its current layout bounds width.-
Parameters
- node
-
Returns
- Number
- public getNodeMinHeight(node: Node) : Number
- public getNodeMinWidth(node: Node) : Number
-
Utility function which returns the minimum width of the
Node
.Utility function which returns the minimum width of the
Node
. Layout containers should not set the width of a Resizable node to a value less than this value.If the node is
Resizable
, the function first checks for aminWidth
value set on the node'slayoutInfo
variable (such a constraint indicates that the application overrode the Resizable's intrinsic minimum width). If no override exists, it returns the Resizable's intrinsic minimum width by callinggetMinWidth()
.If the node is not
Resizable
, then its layout bounds width is returned.-
Parameters
- node
-
Returns
- Number
- public getNodePrefHeight(node: Node) : Number
-
Utility function which returns the preferred height of the
Node
.Utility function which returns the preferred height of the
Node
. Layout containers should strive to set the height of the node to this value.If the node is Resizable, the function first checks for a
height
value set on the node'slayoutInfo
variable (such a constraint indicates that the application overrode the Resizable's intrinsic preferred height). If no override exists, it returns the Resizable's intrinsic preferred height by callinggetPrefHeight
.If the node is not
Resizable
, returns its current layout bounds width.-
Parameters
- node
-
Returns
- Number
- public getNodePrefHeight(node: Node, width: Number) : Number
-
Utility function which returns the preferred height of the
Node
for the given width.Utility function which returns the preferred height of the
Node
for the given width. Layout containers should strive to set the height of the node to this value.If the node is Resizable, the function first checks for a
height
value set on the node'slayoutInfo
variable (such a constraint indicates that the application overrode the Resizable's intrinsic preferred height). If no override exists, it returns the Resizable's intrinsic preferred height by callinggetPrefHeight
.If the node is not
Resizable
, returns its current layout bounds width.-
Parameters
- node
- width
-
Returns
- Number
- public getNodePrefWidth(node: Node) : Number
-
Utility function which returns the preferred width of the
Node
.Utility function which returns the preferred width of the
Node
. Layout containers should strive to set the width of the node to this value.If the node is Resizable, the function first checks for a
width
value set on the node'slayoutInfo
variable (such a constraint indicates that the application overrode the Resizable's intrinsic preferred width). If no override exists, it returns the Resizable's intrinsic preferred width by callinggetPrefWidth
.If the node is not
Resizable
, returns its current layout bounds width.-
Parameters
- node
-
Returns
- Number
- public getNodePrefWidth(node: Node, height: Number) : Number
-
Utility function which returns the preferred width of the
Node
for the given height.Utility function which returns the preferred width of the
Node
for the given height. Layout containers should strive to set the width of the node to this value.If the node is Resizable, the function first checks for a
width
value set on the node'slayoutInfo
variable (such a constraint indicates that the application overrode the Resizable's intrinsic preferred width). If no override exists, it returns the Resizable's intrinsic preferred width by callinggetPrefWidth
.If the node is not
Resizable
, returns its current layout bounds width.-
Parameters
- node
- height
-
Returns
- Number
- public getNodeVFill(node: Node, fallback: Boolean) : Boolean
-
Utility function which returns the vertical fill constraint of the
Node
which defines whether the Resizable should be sized larger than its preferred height (up to its maximum) if it's Resizable and its layout area has additional vertical space.Utility function which returns the vertical fill constraint of the
Node
which defines whether the Resizable should be sized larger than its preferred height (up to its maximum) if it's Resizable and its layout area has additional vertical space.If the node has a non-null
layoutInfo
wherehfill
is set, then that value is returned, else if the node isResizable
then itsgetVFill()
is returned, else the fallback is returned.-
Parameters
- node
- fallback
-
Returns
- Boolean
- public getNodeVGrow(node: Node) : Priority
-
Utility function which returns the vertical grow priority of the
Node
, which defines whether the node's layout area should be allocated additional vertical space if a container has additional vertical space and multiple nodes are competing for it.Utility function which returns the vertical grow priority of the
Node
, which defines whether the node's layout area should be allocated additional vertical space if a container has additional vertical space and multiple nodes are competing for it.If the node has a non-null
layoutInfo
wherevgrow
is set, then that value is returned, else if the node is Resizable then itsgetVGrow()
is returned, elsePriority.NEVER
is returned.-
Parameters
- node
-
Returns
- Priority
- public getNodeVPos(node: Node, fallback: VPos) : VPos
-
Utility function which returns the vertical layout position of the
Node
which defines how the node should be vertically aligned within its layout space if the height of the layout space is greater than the layout bounds height of the node.Utility function which returns the vertical layout position of the
Node
which defines how the node should be vertically aligned within its layout space if the height of the layout space is greater than the layout bounds height of the node.If the node has a non-null
layoutInfo
wherevpos
is set, then that value is returned, else the fallback is returned.-
Parameters
- node
- fallback
-
Returns
- VPos
- public getNodeVShrink(node: Node) : Priority
-
Utility function which returns the vertical shrink priority of the
Node
, which defines whether the node's layout area should shrink if the container's height is less than its preferred height and multiple nodes are competing for that vertical space.Utility function which returns the vertical shrink priority of the
Node
, which defines whether the node's layout area should shrink if the container's height is less than its preferred height and multiple nodes are competing for that vertical space.If the node has a non-null
layoutInfo
wherevshrink
is set, then that value is returned, else if the node is Resizable then itsgetVShrink()
is returned, elsePriority.NEVER
is returned.-
Parameters
- node
-
Returns
- Priority
- public layoutNode(node: Node, x: Number, y: Number, width: Number, height: Number) : Boolean
-
Utility function which Lays out the node so that it will be positioned at
x,y
and if its Resizable, will also set its size towidth
xheight
.Utility function which Lays out the node so that it will be positioned at
x,y
and if its Resizable, will also set its size towidth
xheight
. If the node's width and/or height are bound values then the bound dimension(s) will not be altered. If either the width and/or height were resized, returnstrue
else returnsfalse
. This function does not query the minimum, preferred, or maximum size preferences of the node, nor does it look at any LayoutInfo constraints.-
Parameters
- node
- x
- y
- width
- height
-
Returns
- Boolean
- public layoutNode(node: Node, x: Number, y: Number, width: Number, height: Number, snapToPixel: Boolean) : Boolean
-
Utility function which Lays out the node so that it will be positioned at
x,y
and if its Resizable, will be resized towidth
xheight
.Utility function which Lays out the node so that it will be positioned at
x,y
and if its Resizable, will be resized towidth
xheight
. If the node's width and/or height are bound values then the bound dimension(s) will not be altered. If either the width and/or height were resized, returnstrue
else returnsfalse
. IfsnapToPixel
istrue
, then the resulting x,y and width/height values will be rounded to their nearest pixel boundaries.This function does not query the minimum, preferred, or maximum size preferences of the node, nor does it look at any LayoutInfo constraints.
-
Parameters
- node
- x
- y
- width
- height
- snapToPixel
-
Returns
- Boolean
- public layoutNode(node: Node, areaX: Number, areaY: Number, areaWidth: Number, areaHeight: Number, hpos: HPos, vpos: VPos) : Boolean
-
Note: This function has been superseded by
layoutNode
function which supports vertical baseline alignment, filling, and snap-to-pixel capability.Note: This function has been superseded by
layoutNode
function which supports vertical baseline alignment, filling, and snap-to-pixel capability.-
Parameters
- node
- areaX
- areaY
- areaWidth
- areaHeight
- hpos
- vpos
-
Returns
- Boolean
- public layoutNode(node: Node, areaX: Number, areaY: Number, areaWidth: Number, areaHeight: Number, areaBaselineOffset: Number, hfill: Boolean, vfill: Boolean, hpos: HPos, vpos: VPos, snapToPixel: Boolean) : Boolean
-
Utility function which lays out the node relative to the specified layout area defined by
areaX
,areaY
,areaWidth
xareaHeight
, and a baseline offset relative to that area.Utility function which lays out the node relative to the specified layout area defined by
areaX
,areaY
,areaWidth
xareaHeight
, and a baseline offset relative to that area.If the node is Resizable, then it will be both sized and positioned according to its layout constraints, including its minimum, preferred, and maximum sizes, as well as its fill and alignment preferences.
If the layout area's width/height is greater than the Resizable's preferred width/height, then this function uses the node's fill preference to determine how to resize it. If horizontal/vertical fill is true, then the Resizable will be resized to fill the width/height of the layout area (up to the Resizable's maximum width/height). If horizontal/vertical fill is false, then the Resizable will be kept to its preferred width/height, even though the layout area has more space. The horizontal/vertical fill values are calculated by first looking for LayoutInfo
hfill
and/orvfill
overrides set on the node'slayoutInfo
, and if those are not present, then it uses the Resizable's intrinsic fill preferences defined bygetHFill()/getVFill()
. Note that the "hfill" and "vfill" fallback parameters on this function are no longer used, so just pass inPriority.NEVER
.If the layout area's width/height is smaller than the Resizable's preferred size, then the Resizable will be resized smaller to fit into the area (down to its minimum width/height).
The node's minimum, preferred, and maximum dimensions are calculated by first looking for LayoutInfo size overrides specified on the node's
layoutInfo
; if no overrides are present, then it uses the intrinsic size range returned by the Resizable'sgetMinWidth()/getMinHeight()
,getPrefWidth()/getPrefHeight()
, andgetMaxWidth()/getMaxHeight()
functions.If the node's resulting layout bounds differs from the area's size (either because it was non-Resizable or it's sizing preferences prevented it), then this function will align the node relative to the area using horizontal and vertical position values. These position values are calculated by first looking for LayoutInfo
vpos
and/orhpos
overrides set on the node'slayoutInfo
, and if those are not present then it uses thehpos
andvpos
fallbacks passed as parameters to this function. Ifvpos == VPos.BASELINE
then the node's baseline will be aligned with the area baseline offset passed into the function.If
snapToPixel
istrue
, then the resulting x,y and width/height values will be rounded to their nearest pixel boundaries.-
Parameters
- node
- areaX
- areaY
- areaWidth
- areaHeight
- areaBaselineOffset
- hfill
- vfill
- hpos
- vpos
- snapToPixel
-
Returns
- Boolean
- public positionNode(node: Node, x: Number, y: Number) : Void
-
Utility function which positions the node at
x,y
by settinglayoutX
andlayoutY
to translate the node from it's current layout boundsminX
andminY
values to x,y.Utility function which positions the node at
x,y
by settinglayoutX
andlayoutY
to translate the node from it's current layout boundsminX
andminY
values to x,y.-
Parameters
- node
- x
- y
- public positionNode(node: Node, x: Number, y: Number, snapToPixel: Boolean) : Void
-
Utility function which positions the node at
x,y
by settinglayoutX
andlayoutY
to translate the node from it's current layout boundsminX
andminY
location to x,y.Utility function which positions the node at
x,y
by settinglayoutX
andlayoutY
to translate the node from it's current layout boundsminX
andminY
location to x,y. IfsnapToPixel
istrue
, then the x/y position values will be rounded to their nearest pixel boundaries before calculating the layoutX/layoutY offsets.-
Parameters
- node
- x
- y
- snapToPixel
- public positionNode(node: Node, areaX: Number, areaY: Number, areaWidth: Number, areaHeight: Number, hpos: HPos, vpos: VPos) : Void
-
Utility function which positions the node relative to the specified layout area defined by
areaX
,areaY
,areaWidth
xareaHeight
.Utility function which positions the node relative to the specified layout area defined by
areaX
,areaY
,areaWidth
xareaHeight
.This function does not resize the node and uses the node's layout bounds width and height to determine how it should be positioned within the area. If the node's size differs from the area's size, then this function will align the node relative to the area using horizontal and vertical position values. These position values are calculated by first looking for
vpos
and/orhpos
variables set on the node'slayoutInfo
, and if those are not present then it uses thehpos
andvpos
parameters passed into this function.-
Parameters
- node
- areaX
- areaY
- areaWidth
- areaHeight
- hpos
- vpos
- public positionNode(node: Node, areaX: Number, areaY: Number, areaWidth: Number, areaHeight: Number, areaBaselineOffset: Number, hpos: HPos, vpos: VPos, snapToPixel: Boolean) : Void
-
Utility function which positions the node within the specified layout area defined by
areaX
,areaY
,areaWidth
xareaHeight
, with a baseline offset relative to that area.Utility function which positions the node within the specified layout area defined by
areaX
,areaY
,areaWidth
xareaHeight
, with a baseline offset relative to that area.This function does not resize the node and uses the node's layout bounds width and height to determine how it should be positioned within the area.
If the node has a
layoutInfo
set with values formargin
,hpos
, orvpos
, those value will be used in computing the node's position within the specified area. If no position values are set onlayoutInfo
then thehpos
andvpos
parameters are used to determine alignment within the area.If the node's vertical position (
vpos
) isVPos.BASELINE
then it will position the node so that its own baseline aligns with the passed inbaselineOffset
, otherwise it will align the node vertically withinareaHeight
according to its vertical position value as described above.If
snapToPixel
istrue
, then the x/y position values will be rounded to their nearest pixel boundaries before calculating the layoutX/layoutY offsets.-
Parameters
- node
- areaX
- areaY
- areaWidth
- areaHeight
- areaBaselineOffset
- hpos
- vpos
- snapToPixel
Profile: common
- public resizeNode(node: Node, width: Number, height: Number) : Boolean
-
Utility function which resizes the node if possible.
Utility function which resizes the node if possible. If the node is Resizable and either its width and/or height variables are not bound, then this function sets the width and/or height and returns
true
. If width and height are bound or the node is notResizable
then this function does nothing and returnsfalse
.-
Parameters
- node
- width
- height
-
Returns
- Boolean
- public resizeNode(node: Node, width: Number, height: Number, snapToPixel: Boolean) : Boolean
-
Utility function which resizes the node if possible.
Utility function which resizes the node if possible. If the node is Resizable and either its width and/or height variables are not bound, then this function sets the width and/or height and returns
true
. If width and height are bound or the node is notResizable
then this function does nothing and returnsfalse
. IfsnapToPixel
istrue
, then the width/height values will be rounded to their nearest pixel boundaries.-
Parameters
- node
- width
- height
- snapToPixel
-
Returns
- Boolean
- public setNodeHeight(node: Node, height: Number) : Boolean
-
Utility function which resizes the node's height if possible.
Utility function which resizes the node's height if possible. If the node is Resizable and its height is not bound, sets the height and returns
true
, else does nothing and returnsfalse
.-
Parameters
- node
- height
-
Returns
- Boolean
- public setNodeHeight(node: Node, height: Number, snapToPixel: Boolean) : Boolean
-
Utility function which resizes the node's height if possible.
Utility function which resizes the node's height if possible. If the node is Resizable and its height is not bound, sets the height and returns
true
, else does nothing and returnsfalse
. IfsnapToPixel
istrue
, then height will be rounded to its nearest pixel boundary.-
Parameters
- node
- height
- snapToPixel
-
Returns
- Boolean
- public setNodeWidth(node: Node, width: Number) : Boolean
-
Utility function which resizes the node's width if possible.
Utility function which resizes the node's width if possible. If the node is Resizable and its width is not bound, sets the width and returns
true
, else does nothing and returnsfalse
.-
Parameters
- node
- width
-
Returns
- Boolean
- public setNodeWidth(node: Node, width: Number, snapToPixel: Boolean) : Boolean
-
Utility function which resizes the node's width if possible.
Utility function which resizes the node's width if possible. If the node is Resizable and its width is not bound, sets the width and returns
true
, else does nothing and returnsfalse
. IfsnapToPixel
istrue
, then width will be rounded to its nearest pixel boundary.-
Parameters
- node
- width
- snapToPixel
-
Returns
- Boolean
Function Summary
- protected bound computeBaselineOffset() : Number
-
Computes the baseline offset for this container by returning the baseline location of the first managed content node, else returns the container's
layoutBounds.height
.Computes the baseline offset for this container by returning the baseline location of the first managed content node, else returns the container's
layoutBounds.height
.-
Returns
- Number
Profile: common
- protected doLayout() : Void
-
Invoked during the layout pass to layout the managed content nodes in this
Container
.Invoked during the layout pass to layout the managed content nodes in this
Container
. By default it will only set the size of managedResizable
content to their preferred sizes and does not do any node positioning.Subclasses should override this function to layout content as needed.
- getPrefHeight(width: Number) : Number
-
Returns the preferred height of this container.
Returns the preferred height of this container. The default implementation of this function returns the height required to encompass the preferred layout bounds of all managed content. The
width
parameter is ignored.Subclasses should override this function to return the height needed to layout their content.
-
Parameters
- width
-
Returns
- Number
- getPrefWidth(height: Number) : Number
-
Returns the preferred width of this container.
Returns the preferred width of this container. The default implementation of this function returns the width required to encompass the preferred layout bounds of all managed content. The
height
parameter is ignored.Subclasses should override this function to return the width needed to layout their content.
-
Parameters
- height
-
Returns
- Number
- requestLayout() : Void
Inherited Functions
javafx.scene.Parent
- public layout() : Void
- public lookup(id: java.lang.String) : Node
- public requestLayout() : Void
-
Requests a layout pass to be performed before the next scene is rendered.
Requests a layout pass to be performed before the next scene is rendered. This is batched up asynchronously to happen once per "pulse", or frame of animation.
If this parent is either a layout root or unmanaged, then it will be added directly to the scene's dirty layout list, otherwise requestLayout will be invoked on its parent.
javafx.scene.Node
- public contains(localX: Number, localY: Number) : Boolean
-
Returns
true
if the given point (specified in the local coordinate space of thisNode
) is contained within the shape of thisNode
.Returns
true
if the given point (specified in the local coordinate space of thisNode
) is contained within the shape of thisNode
. Note that this method does not take visibility into account; the test is based on the geometry of thisNode
only.-
Parameters
- localX
- localY
-
Returns
- Boolean
Profile: common
- public contains(localPoint: Point2D) : Boolean
-
Returns
true
if the given point (specified in the local coordinate space of thisNode
) is contained within the shape of thisNode
.Returns
true
if the given point (specified in the local coordinate space of thisNode
) is contained within the shape of thisNode
. Note that this method does not take visibility into account; the test is based on the geometry of thisNode
only.-
Parameters
- localPoint
-
Returns
- Boolean
Profile: common
- public intersects(localX: Number, localY: Number, localWidth: Number, localHeight: Number) : Boolean
-
Returns
true
if the given rectangle (specified in the local coordinate space of thisNode
) intersects the shape of thisNode
.Returns
true
if the given rectangle (specified in the local coordinate space of thisNode
) intersects the shape of thisNode
. Note that this method does not take visibility into account; the test is based on the geometry of thisNode
only. The default behavior of this function is simply to check if the given coordinates intersect with the local bounds.-
Parameters
- localX
- localY
- localWidth
- localHeight
-
Returns
- Boolean
Profile: common
- public intersects(localBounds: Bounds) : Boolean
-
Returns
true
if the given bounds (specified in the local coordinate space of thisNode
) intersects the shape of thisNode
.Returns
true
if the given bounds (specified in the local coordinate space of thisNode
) intersects the shape of thisNode
. Note that this method does not take visibility into account; the test is based on the geometry of thisNode
only. The default behavior of this function is simply to check if the given coordinates intersect with the local bounds.-
Parameters
- localBounds
-
Returns
- Boolean
Profile: common
- public localToParent(localX: Number, localY: Number) : Point2D
- public localToParent(localPoint: Point2D) : Point2D
- public localToParent(localBounds: Bounds) : Bounds
- public localToScene(localX: Number, localY: Number) : Point2D
-
Transforms a point from the local coordinate space of this
Node
into the coordinate space of its javafx.scene.Scene.Transforms a point from the local coordinate space of this
Node
into the coordinate space of its javafx.scene.Scene.-
Parameters
- localX
- localY
-
Returns
- Point2D
Profile: common
- public localToScene(localPoint: Point2D) : Point2D
-
Transforms a point from the local coordinate space of this
Node
into the coordinate space of its javafx.scene.Scene.Transforms a point from the local coordinate space of this
Node
into the coordinate space of its javafx.scene.Scene.-
Parameters
- localPoint
-
Returns
- Point2D
Profile: common
- public localToScene(localBounds: Bounds) : Bounds
-
Transforms a bounds from the local coordinate space of this
Node
into the coordinate space of its javafx.scene.Scene.Transforms a bounds from the local coordinate space of this
Node
into the coordinate space of its javafx.scene.Scene.-
Parameters
- localBounds
-
Returns
- Bounds
Profile: common
- public lookup(id: java.lang.String) : Node
-
Finds this
Node
, or the first subnode, with the given id.Finds this
Node
, or the first subnode, with the given id. If this node is aParent
, then this function will traverse down into the branch until it finds a match. If more than one subnode has the specified id, this function returns one of them. Which node it returns in that case is unspecified.-
Parameters
- id
- The id of the node to find
-
Returns
- Node
-
The first node, starting from this
Node
, which has an id ofid
.
Profile: common
- public parentToLocal(parentX: Number, parentY: Number) : Point2D
- public parentToLocal(parentPoint: Point2D) : Point2D
- public parentToLocal(parentBounds: Bounds) : Bounds
- public requestFocus() : Void
-
Requests that this
Node
get the input focus, and that thisNode
's top-level ancestor become the focused window.Requests that this
Node
get the input focus, and that thisNode
's top-level ancestor become the focused window. To be eligible to receive the focus, the node must be part of a scene, it and all of its ancestors must be visible, and it must not be disabled. If this node is eligible, this function will cause it to become thisScene
's "focus owner". Each scene has at most one focus owner node. The focus owner will not actually have the input focus, however, unless the scene belongs to aStage
that is both visible and active.Profile: common
- public sceneToLocal(sceneX: Number, sceneY: Number) : Point2D
- public sceneToLocal(scenePoint: Point2D) : Point2D
-
Transforms a point from the coordinate space of the javafx.scene.Scene into the local coordinate space of this
Node
.Transforms a point from the coordinate space of the javafx.scene.Scene into the local coordinate space of this
Node
.-
Parameters
- scenePoint
-
Returns
- Point2D
Profile: common
- public sceneToLocal(sceneBounds: Bounds) : Bounds
-
Transforms a rectangle from the coordinate space of the javafx.scene.Scene into the local coordinate space of this
Node
.Transforms a rectangle from the coordinate space of the javafx.scene.Scene into the local coordinate space of this
Node
.-
Parameters
- sceneBounds
-
Returns
- Bounds
Profile: common
- public toBack() : Void
-
Moves this
Node
to the back of its sibling nodes in terms of z-order.Moves this
Node
to the back of its sibling nodes in terms of z-order. This is accomplished by moving thisNode
to the first position in its parent'scontent
sequence. This function has no effect if thisNode
is not part of a group.Profile: common
- public toFront() : Void
-
Moves this
Node
to the front of its sibling nodes in terms of z-order.Moves this
Node
to the front of its sibling nodes in terms of z-order. This is accomplished by moving thisNode
to the last position in its parent'scontent
sequence. This function has no effect if thisNode
is not part of a group.Profile: common
- public toString() : java.lang.String
javafx.scene.layout.Resizable
- public getHFill() : Boolean
-
Returns the
Resizable
's horizontal fill preference, which indicates whether or not the Resizable's width should be resized beyond its preferred width (up to its maximum) to fill it's allocated layout area.Returns the
Resizable
's horizontal fill preference, which indicates whether or not the Resizable's width should be resized beyond its preferred width (up to its maximum) to fill it's allocated layout area.All container classes (HBox, VBox, Stack, Flow(vertical), Tile) consult this preference when resizing Resizable children.
An application may override the horizontal fill of a Resizable node using LayoutInfo:
Label { layoutInfo: LayoutInfo { hfill: true } }
This function returns
false
by default; Resizable subclasses should override this function to return an appropriate value.-
Returns
- Boolean
- public getHGrow() : Priority
-
Returns the
Resizable
's horizontal grow priority which determines whether it's layout area is given more horizontal space if its available.Returns the
Resizable
's horizontal grow priority which determines whether it's layout area is given more horizontal space if its available.The horizontal grow priority is only used if the parent container is resized larger than its preferred width and multiple nodes are competing for extra horizontal space, which for the concrete containers is only applicable to HBox. Note that growing applies only to the layout area assigned to the Resizable; how the Resizable is sized with respect to that area is determined separately by its size and fill preferences (see getPrefWidth and getHFill).
If
ALWAYS
, the Resizable's layout area will always grow horizontally if there is additional space, sharing the increase with other nodes that have an hgrow of ALWAYS. The Resizable's layout area will never be grown beyond the Resizable's maximum width.If
SOMETIMES
, the Resizable's layout area will only grow horizontally if either no other node has specified ALWAYS, or the additional space was not completely allocated to nodes specifying ALWAYS because of their maximum size limits.If
NEVER
, the Resizable's layout area will never be grown horizontally if there is additional space.If the Resizable returns ALWAYS or SOMETIMES, then getHFill should typically return
true
to ensure the node will be resized beyond its preferred to take advantage of its larger layout area.An application may override the horizontal grow priority of a Resizable node using LayoutInfo:
Label { layoutInfo: LayoutInfo { hgrow: Priority.ALWAYS } }
This function returns
Priority.NEVER
by default; Resizable subclasses should override this function to return an appropriate value.-
Returns
- Priority
- public getHShrink() : Priority
-
Returns the
Resizable
's horizontal shrink priority, which determines whether it's layout area is given less horizontal space if its parent is resized smaller than its preferred width.Returns the
Resizable
's horizontal shrink priority, which determines whether it's layout area is given less horizontal space if its parent is resized smaller than its preferred width.The horizontal shrink priority is only used if the parent container is resized smaller than its preferred width and multiple nodes are competing for horizontal space, which for the concrete containers is only applicable to HBox.
If
ALWAYS
, the Resizable's layout area will always shrink horizontally if there is less space, sharing the decrease with other nodes that have an hshrink of ALWAYS. The Resizable's layout area will never be sized smaller than the node's minimum width.If
SOMETIMES
, the Resizable's layout area will only shrink horizontally if either no other node has specified ALWAYS, or the reduced space was not completely distributed to nodes specifying ALWAYS because of their minimum size limits.If
NEVER
, the Resizable's layout area will never be shrunken horizontally if there is reduced space.An application may override the horizontal shrink priority of a Resizable node using LayoutInfo:
Label { layoutInfo: LayoutInfo { hshrink: Priority.ALWAYS } }
This function returns
Priority.NEVER
by default; Resizable subclasses should override this function to return an appropriate value.-
Returns
- Priority
- public getMaxHeight() : Number
-
Returns the
Resizable
's maximum height.Returns the
Resizable
's maximum height. Layout containers should strive not to set the Resizable'sheight
larger than this value. This value is computed by the node subclass using applicable state and variable settings and is not directly settable by applications.An application may override the maximum height of a Resizable node using LayoutInfo:
Label { layoutInfo: LayoutInfo { maxHeight: 30 } }
This function returns
Integer.MAX_VALUE
by default; Resizable subclasses should override this function to return an appropriate value.-
Returns
- Number
Profile: common
- public getMaxWidth() : Number
-
Returns the
Resizable
's maximum width.Returns the
Resizable
's maximum width. Layout containers should strive not to set the Resizable'swidth
larger than this value. This value is computed by the node subclass using applicable state and variable settings and is not directly settable by applications.An application may override the maximum width of a Resizable node using LayoutInfo:
Label { layoutInfo: LayoutInfo { maxWidth: 30 } }
This function returns
Integer.MAX_VALUE
by default; Resizable subclasses should override this function to return an appropriate value.-
Returns
- Number
Profile: common
- public getMinHeight() : Number
-
Returns the
Resizable
's minimum height.Returns the
Resizable
's minimum height. Layout containers should strive not to set the Resizable's height smaller than this value. This value is computed by the node subclass using applicable state and variable settings and is not directly settable by applications.An application may override the minimum height of a Resizable node using LayoutInfo:
Label { layoutInfo: LayoutInfo { minHeight: 30 } }
This function returns 0 by default; Resizable subclasses should override this function to return an appropriate value.
-
Returns
- Number
Profile: common
- public getMinWidth() : Number
-
Returns the
Resizable
's minimum width.Returns the
Resizable
's minimum width. Layout containers should strive not to set the Resizable's width smaller than this value. This value is calculated by the node subclass using applicable state and variable settings and is not directly settable by applications.An application may override the minimum width of a Resizable node using LayoutInfo:
Label { layoutInfo: LayoutInfo { minWidth: 50 } }
This function returns 0 by default; Resizable subclasses should override this function to return an appropriate value.
-
Returns
- Number
Profile: common
- public abstract getPrefHeight(width: Number) : Number
-
Returns the
Resizable
's preferred height, given the specified width.Returns the
Resizable
's preferred height, given the specified width. If a particular width need not be factored into the result, -1 may be passed in as thewidth
parameter. Implementations of this function may also choose to ignorewidth
if it does not impact the result.Layout containers should set the Resizable's
height
to this value whenever possible. This value is computed by the node subclass using applicable state and variable settings and is not directly settable by applications.An application may override the preferred height of a Resizable node using LayoutInfo:
Label { layoutInfo: LayoutInfo { height: 80 } }
Resizable subclasses must override this function to return an appropriate value.
-
Parameters
- width
-
Returns
- Number
Profile: common
- public abstract getPrefWidth(height: Number) : Number
-
Returns the
Resizable
's preferred width, given the specified height.Returns the
Resizable
's preferred width, given the specified height. If a particular height need not be factored into the result, -1 may be passed in as theheight
parameter. Implementations of this function may also choose to ignoreheight
if it does not impact the result.Layout containers should set the Resizable's
width
to this value whenever possible. This value is computed by the node subclass using applicable state and variable settings and is not directly settable by applications.An application may override the preferred width of a Resizable node using LayoutInfo:
Label { layoutInfo: LayoutInfo { width: 50 } }
Resizable subclasses must override this function to return an appropriate value.
-
Parameters
- height
-
Returns
- Number
Profile: common
- public getVFill() : Boolean
-
Returns the
Resizable
's vertical fill preference, which indicates whether or not the Resizable's height should be resized beyond its preferred height (up to its maximum) to fill it's allocated layout area.Returns the
Resizable
's vertical fill preference, which indicates whether or not the Resizable's height should be resized beyond its preferred height (up to its maximum) to fill it's allocated layout area.All container classes (HBox, VBox, Stack, Flow(horizontal), Tile) consult this preference when resizing Resizable children.
An application may override the vertical fill of a Resizable node using LayoutInfo:
Label { layoutInfo: LayoutInfo { vfill: true } }
This function returns
false
by default; Resizable subclasses should override this function to return an appropriate value.-
Returns
- Boolean
- public getVGrow() : Priority
-
Returns the
Resizable
's vertical grow priority, which determines whether it's layout area is given more vertical space if its available.Returns the
Resizable
's vertical grow priority, which determines whether it's layout area is given more vertical space if its available.The vertical grow priority is only used if the parent container is resized larger than its preferred height and multiple nodes are competing for extra vertical space, which for the concrete containers is only applicable to VBox. Note that growing applies only to the layout area assigned to the Resizable; how the Resizable is sized with respect to that area is determined separately by its size and fill preferences (see getPrefHeight and getVFill).
If
ALWAYS
, the Resizable's layout area will always grow vertically if there is additional space, sharing the increase with other nodes that have an vgrow of ALWAYS. The Resizable's layout area will never be grown beyond the Resizable's maximum height.If
SOMETIMES
, the Resizable's layout area will only grow vertically if either no other node has specified ALWAYS, or the additional space was not completely allocated to nodes specifying ALWAYS because of their maximum size limits.If
NEVER
, the Resizable's layout area will never be grown vertically if there is additional space.If the Resizable returns ALWAYS or SOMETIMES, then getVFill should typically return
true
to ensure the node will be resized beyond its preferred to take advantage of its larger layout area.An application may override the vertical grow priority of a Resizable node using LayoutInfo:
Label { layoutInfo: LayoutInfo { vgrow: Priority.ALWAYS } }
This function returns
Priority.NEVER
by default; Resizable subclasses should override this function to return an appropriate value.-
Returns
- Priority
- public getVShrink() : Priority
-
Returns the
Resizable
's vertical shrink priority, which determines whether it's layout area is given less vertical space if its parent is resized smaller than its preferred height.Returns the
Resizable
's vertical shrink priority, which determines whether it's layout area is given less vertical space if its parent is resized smaller than its preferred height.The vertical shrink priority is only used if the parent container is resized smaller than its preferred height and multiple nodes are competing for vertical space, which for the concrete containers is only applicable to VBox.
If
ALWAYS
, the Resizable's layout area will always shrink vertically if there is less space, sharing the decrease with other nodes that have an vshrink of ALWAYS. The Resizable's layout area will never be sized smaller than the node's minimum height.If
SOMETIMES
, the Resizable's layout area will only shrink vertically if either no other node has specified ALWAYS, or the reduced space was not completely distributed to nodes specifying ALWAYS because of their minimum size limits.If
NEVER
, the Resizable's layout area will never be shrunken vertically if there is reduced space.An application may override the vertical shrink priority of a Resizable node using LayoutInfo:
Label { layoutInfo: LayoutInfo { vshrink: Priority.ALWAYS } }
This function returns
Priority.NEVER
by default; Resizable subclasses should override this function to return an appropriate value.-
Returns
- Priority