JavaFX: Bringing Rich Experiences To All the Screens Of Your Life

expand all

Profile: desktop, common

Overview

Warning: This class is an experimental/preview control that is not final and will change in future releases. If you have any feedback on this control, please post it to the JavaFX JIRA issue tracker.

The SplitMenuButton, like the MenuButton is closely associated with the concept of selecting a MenuItem from a menu. Unlike MenuButton, the SplitMenuButton is broken into two pieces, the "action" area and the "menu open" area.

If the user clicks in the action area, the SplitMenuButton will act similarly to a Button, firing whatever is associated with the action property.

The menu open area of the control will show a menu if clicked. When the user selects an item from the menu, it is executed. The selected menu item then becomes the "last" menu item in the control. One common idiom would be to bind the actionItem to the lastItem such that a subsequent click on the button action area re-executes the last executed menu item.

An example way of using the SplitMenuButton is shown below. Note that the API is essentially the same as MenuButton and Menu, with the addition of a action property.


SplitMenuButton {
    text: "Default action"
    action: function() { println("Default Action Started"); }
    items: [
        MenuItem { text: "Btn 1", action: function() { println("Action 1"); } }
        MenuItem { text: "Btn 2", action: function() { println("Action 2"); } }
        MenuItem { text: "Btn 3", action: function() { println("Action 3"); } }
    ]
}

In many cases a SplitMenuButton has an action specified that is not available within the menu itself, and for that reason the SplitMenuButton does not automatically assign whatever was last selected in the menu to be the action should the action region be clicked. If you want this effect, it is possible by doing the following:


var btn = SplitMenuButton {
    text: bind if (btn.lastItem == null) "SplitMenuButton" else btn.lastItem.text
    action: bind btn.lastItem.action;
    items: [
        MenuItem { text: "Btn 1", action: function() { println("Action 1"); } }
        MenuItem { text: "Btn 2", action: function() { println("Action 2"); } }
        MenuItem { text: "Btn 3", action: function() { println("Action 3"); } }
    ]
}

See Also:
MenuItem, Menu

Profile: common

Variable Summary

accessnametypeCan ReadCan InitCan WriteDefault Valuedescription
publicactionfunction():Void

The button's action, which is invoked whenever the user clicks on the button part of the split menu button.

public-readlastItemMenuItem

The last menu item that was executed.

The last menu item that was executed. If you wish the that the button part to always be the last item executed, then simply bind one or all of text, action, graphic etc to the lastItem.

 

Inherited Variables

com.javafx.preview.control.MenuButton

accessnametypeCan ReadCan InitCan WriteDefault Valuedescription
publicitemsNode[]

The items to show within this buttons menu.

The items to show within this buttons menu. If this sequence is modified at runtime, the Menu will update as expected.

Commonly used controls include items which extend from MenuItemBase, including MenuItem, CheckMenuItem, RadioMenuItem, and of course Menu, which if added to a menu, will become a sub menu. Separator is another commonly used Node in the Menu's items sequence.

 
publicopenVerticallyBooleantrue

Indicates whether the menu should open vertically in relation to the MenuButton or horizontally.

Indicates whether the menu should open vertically in relation to the MenuButton or horizontally. Menu items are generally laid out vertically in either case. This variable simple provides information to the Skin as to which side of the MenuButton control to open the menu. For example, if the menu button were in a vertical toolbar on the left edge of the application, you might change openVertically to false so that the popup will appear to the right of the MenuButton.

true  
public-readshowingBoolean

javafx.scene.control.ButtonBase

accessnametypeCan ReadCan InitCan WriteDefault Valuedescription
public-readarmedBoolean

Indicates that the button has been "armed" such that a mouse release will cause the button's action to be invoked.

Indicates that the button has been "armed" such that a mouse release will cause the button's action to be invoked. This is subtly different from pressed. pressed indicates that the mouse has been pressed on a Node and has not yet been released. armed however also takes into account whether the mouse is actually over the button and pressed.

 

javafx.scene.control.Control

accessnametypeCan ReadCan InitCan WriteDefault Valuedescription
publicskinSkin

Skin responsible for rendering this Control.

Skin responsible for rendering this Control. From the perspective of the Control, the Skin is a black box. It listens and responds to changes in state in a Control.

There is a one-to-one relationship between a Control and its Skin. Every Skin maintains a back reference to the Control.

A skin may be null.

Profile: common

 
publictooltipTooltip

Set ToolTip for this control

javafx.scene.Parent

accessnametypeCan ReadCan InitCan WriteDefault Valuedescription
protectedchildrenNode[]subclasssubclasssubclassempty

A sequence of child Nodes.

A sequence of child Nodes. A CustomNode subclass may override or bind to this sequence as needed.

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: AssignToBoundException if the same node appears in two different bound sequences.

empty

Profile: common

 
public-read protectedneedsLayoutBooleansubclasssubclass

Indicates that this Node and its subnodes requires a layout pass on the next pulse.

javafx.scene.Node

accessnametypeCan ReadCan InitCan WriteDefault Valuedescription
publicblocksMouseBooleanfalse

If true, consumes mouse events in this Node and does not send them to other nodes further up the scene graph.

If true, consumes mouse events in this Node and does not send them to other nodes further up the scene graph. If a Node wants to block mouse events from going to nodes which are visually obscured by this Node, then set blocksMouse to true.

false

Profile: common

 
public-readboundsInLocalBounds

The rectangular bounds of this Node in the node's untransformed local coordinate space.

The rectangular bounds of this Node in the node's untransformed local coordinate space. For nodes that extend javafx.scene.shape.Shape, the local bounds will also include space required for a non-zero stroke that may fall outside the shape's geometry that is defined by position and size attributes. The local bounds will also include any clipping set with clip as well as effects set with effect.

Note that this method does not take the node's visibility into account; the test is based on the geometry of this Node only.

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

The rectangular bounds of this Node which include its transforms.

The rectangular bounds of this Node which include its transforms. boundsInParent is calculated by taking its local bounds (defined by boundsInLocal) and applying the transform created by setting the following additional variables:

  1. transforms[] sequence
  2. scaleX, scaleY
  3. rotate
  4. layoutX, layoutY
  5. translateX, translateY

The resulting bounds will be conceptually in the coordinate space of the Node's parent, however the node need not have a parent to calculate these bounds.

Note that this method does not take the node's visibility into account; the test is based on the geometry of this Node only.

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

 
publiccacheBooleanfalse

A performance hint to the system to indicate that this Node should be cached as a bitmap.

A performance hint to the system to indicate that this Node should be cached as a bitmap. Rendering a bitmap representation of a node will be faster than rendering primitives in many cases, especially in the case of primitives with effects applied (such as a blur). However, it also increases memory usage. This hint indicates whether that trade-off (increased memory usage for increased performance) is worthwhile. Also note that on some platforms such as GPU accelerated platforms there is little benefit to caching Nodes as bitmaps when blurs and other effects are used since they are very fast to render on the GPU. The cacheHint variable provides additional options for enabling more aggressive bitmap caching.

false

See Also:
Node.cacheHint

Profile: common

 
publiccacheHintCacheHintCacheHint.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 cacheHint variable provides a hint to the system about how and when that trade-off (visual quality for animation performance) is acceptable.

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:


 expensiveNode.cache = true;
 expensiveNode.cacheHint = CacheHint.QUALITY;
 ...
 // Do an animation
 expensiveNode.cacheHint = CacheHint.SPEED;
 Timeline {
     keyFrames: [
         KeyFrame {
             time: 2s
             values: [
                 expensiveNode.scaleX => 2.0,
                 expensiveNode.scaleY => 2.0,
                 expensiveNode.rotate=> 360,
                 expensiveNode.cacheHint => CacheHint.QUALITY
             ]
        }
     ]
 }.play();
 
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 Node.cache is false, cacheHint is ignored.

CacheHint.DEFAULT

See Also:
Node.cache

Profile: common

 
publicclipNodenull

Specifies a Node to use to define the the clipping shape for this Node.

Specifies a Node to use to define the the clipping shape for this Node. This clipping Node is not a child of this Node in the scene graph sense. Rather, it is used to define the clip for this Node.

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.

null

Profile: common conditional shape_clip

 
publiccursorCursornull

Defines the mouse cursor for this Node and subnodes.

Defines the mouse cursor for this Node and subnodes. If null, then the cursor of the first parent node with a non-null cursor will be used. If no Node in the scene graph defines a cursor, then the cursor of the Scene will be used.

null

Profile: common

 
publicdisableBooleanfalse

Sets the individual disabled state of this Node.

Sets the individual disabled state of this Node. Setting disable to true will cause this Node and any subnodes to become disabled. This variable should be used only to set the disabled state of a Node. For querying the disabled state of a Node, the disabled variable should instead be used, since it is possible that a Node was disabled as a result of an ancestor being disabled even if the individual disable state on this Node is false.

false

Profile: common

 
public-readdisabledBooleanfalse

Indicates whether or not this Node is disabled.

Indicates whether or not this Node is disabled. A Node will become disabled if disable is set to true on either itself or one of its ancestors in the scene graph.

A disabled Node should render itself differently to indicate its disabled state to the user. Such disabled rendering is dependent on the implementation of the Node. The shape classes contained in javafx.scene.shape do not implement such rendering by default, therefore applications using shapes for handling input must implement appropriate disabled rendering themselves. The user-interface controls defined in javafx.scene.control will implement disabled-sensitive rendering, however.

A disabled Node does not receive mouse or key events.

false

Profile: common

 
publiceffectEffectnull

Specifies an effect to apply to this Node.

Specifies an effect to apply to this Node.

Note: this is a conditional feature. See ConditionalFeature.EFFECT for more information.

null

Profile: common conditional effect

 
public-read protectedfocusedBooleansubclasssubclassfalse

Indicates whether this Node currently has the input focus.

Indicates whether this Node currently has the input focus. To have the input focus, a node must be the Scene's focus owner, and the scene must be in a Stage that is visible and active. See requestFocus() for more information.

false

Profile: common

 
publicfocusTraversableBooleanfalse

Specifies whether this Node should be a part of focus traversal cycle.

Specifies whether this Node should be a part of focus traversal cycle. When this property is true focus can be moved to this Node and from this Node using regular focus traversal keys. On a desktop such keys are usually TAB for moving focus forward and SHIFT+TAB for moving focus backward. When a Scene is created, the system gives focus to a Node whose focusTraversable variable is true and that is eligible to receive the focus, unless the focus had been set explicitly via a call to requestFocus().

false

Profile: common

 
public-read protectedhoverBooleansubclasssubclassfalse

Whether or not this Node is being hovered over.

Whether or not this Node is being hovered over. Typically this is due to the mouse being over the node, though it could be due to a pen hovering on a graphics tablet or other form of input.

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.

false

Profile: common

 
publicidStringempty string

The id of this Node.

The id of this Node. This simple string identifier is useful for finding a specific Node within the scene graph. While the id of a Node should be unique within the scene graph, this uniqueness is not enforced. This is analogous to the "id" attribute on an HTML element.

empty string

Profile: common

 
public-read protectedlayoutBoundsBoundssubclasssubclass

The rectangular bounds that should be used for layout calculations on this Node.

The rectangular bounds that should be used for layout calculations on this Node. layoutBounds may differ from the visual bounds of the node and is computed differently depending on the node type.

See javafx.scene.shape.Shape, javafx.scene.text.Text, Group, and javafx.scene.layout.Resizable for detailed descriptions on how layoutBounds are computed.

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 Node (using layoutBounds) and then set layoutX and layoutY to adjust the translation of the Node so that it will have the desired layout position.

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 layoutBounds. For example, the "x" or "y" variables of a shape should never be bound to layoutBounds for the purpose of positioning the node.

Profile: common

 
publiclayoutInfoLayoutInfoBase

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 LayoutInfo will affect all such nodes.

 
publiclayoutXNumber0

Defines the x coordinate of the translation that is added to this Node's transform for the purpose of layout.

Defines the x coordinate of the translation that is added to this Node's transform for the purpose of layout. The value should be computed as the offset required to adjust the position of the node from its current layoutBounds.minX position (which might not be 0) to the desired location.

For example, if textnode should be positioned at finalX:

     textnode.layoutX = finalX - textnode.layoutBounds.minX;
 

Failure to subtract layoutBounds.minX may result in misplacement of the node.

The node's final translation will be computed as layoutX + translateX, where layoutX establishes the node's stable position and translateX optionally makes dynamic adjustments to that position.

If the node is managed and has a javafx.scene.layout.Container as its parent, then the container will set layoutX according to its own layout policy. If the node is unmanaged or parented by a Group or Scene, then the application may set layoutX directly to position it.

0

Profile: common

 
publiclayoutYNumber0

Defines the y coordinate of the translation that is added to this Node's transform for the purpose of layout.

Defines the y coordinate of the translation that is added to this Node's transform for the purpose of layout. The value should be computed as the offset required to adjust the position of the node from its current layoutBounds.minY position (which might not be 0) to the desired location.

For example, if textnode should be positioned at finalY:

     textnode.layoutY = finalY - textnode.layoutBounds.minY;
 

Failure to subtract layoutBounds.minY may result in misplacement of the node.

The node's final translation will be computed as layoutY + translateY, where layoutY establishes the node's stable position and translateY optionally makes dynamic adjustments to that position.

If the node is managed and has a javafx.scene.layout.Container as its parent, then the container will set layoutY according to its own layout policy. If the node is unmanaged or parented by a Group or Scene, then the application may set layoutY directly to position it.

0

Profile: common

 
publicmanagedBooleantrue

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:

  • Group: sets the size of any Resizable children to their preferred size; does not alter the size of non-Resizable children; does not position children.
  • javafx.scene.layout.Container classes: set the size of any javafx.scene.layout.Resizable content according to its layout rules and each Resizable's sizing preferences; does not alter the size of non-Resizable content; will position nodes (setting layoutX/layoutY) according to its layout rules.
  • CustomNode: by default it behaves like Group, however its layout behavior may be overridden by a subclass.
Parents will ignore unmanaged children for the purposes of layout and it is the application's responsibility to set the size and position of an unmanaged node. By default all nodes are managed.

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  
publiconKeyPressedfunction(:KeyEvent):Void

Defines a function to be called when this Node has input focus and a key has been pressed.

publiconKeyReleasedfunction(:KeyEvent):Void

Defines a function to be called when this Node has input focus and a key has been released.

publiconKeyTypedfunction(:KeyEvent):Void

Defines a function to be called when this Node has input focus and a key has been typed.

publiconMouseClickedfunction(:MouseEvent):Void

Defines a function to be called when a mouse button has been clicked (pressed and released) on this Node.

publiconMouseDraggedfunction(:MouseEvent):Void

Defines a function to be called when a mouse button is pressed on this Node and then dragged.

publiconMouseEnteredfunction(:MouseEvent):Void

Defines a function to be called when the mouse enters this Node.

publiconMouseExitedfunction(:MouseEvent):Void

Defines a function to be called when the mouse exits this Node.

publiconMouseMovedfunction(:MouseEvent):Void

Defines a function to be called when mouse cursor moves within this Node but no buttons have been pushed.

publiconMousePressedfunction(:MouseEvent):Void

Defines a function to be called when a mouse button has been pressed on this Node.

publiconMouseReleasedfunction(:MouseEvent):Void

Defines a function to be called when a mouse button has been released on this Node.

publiconMouseWheelMovedfunction(:MouseEvent):Void

Defines a function to be called when the mouse scroll wheel has moved.

publicopacityNumber1.0

Specifies how opaque (that is, solid) the Node appears.

Specifies how opaque (that is, solid) the Node appears. A Node with 0% opacity is fully translucent. That is, while it is still visible and rendered, you generally won't be able to see it. The exception to this rule is when the ZNode is combined with a blending mode and blend effect in which case a translucent Node may still have an impact in rendering. An opacity of 50% will render the node as being 50% transparent.

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.0

Profile: common

 
public-read packageparentParentnull

The parent of this Node.

The parent of this Node. If this Node has not been added to a scene graph, then parent will be null.

null

Profile: common

 
publicpickOnBoundsBooleanfalse

Defines how the picking computation is done for this node when triggered by a MouseEvent or a contains function call.

Defines how the picking computation is done for this node when triggered by a MouseEvent or a contains function call. If pickOnBounds is true, then picking is computed by intersecting with the bounds of this node, else picking is computed by intersecting with the geometric shape of this node.

false

Profile: common

 
public-read protectedpressedBooleansubclasssubclassfalse

Whether or not the Node is pressed.

Whether or not the Node is pressed. Typically this is true when the primary mouse button is down, though subclasses may define other mouse button state or key state to cause the node to be "pressed".

false

Profile: common

 
publicrotateNumber0.0

Defines the angle of rotation about the Node's center, measured in degrees.

Defines the angle of rotation about the Node's center, measured in degrees. This is used to rotate the Node.

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 Node's layout bounds, any change to the layout bounds will cause the pivot point to change, which can move the object. For a leaf node, any change to the geometry will cause the layout bounds to change. For a group node, any change to any of its children, including a change in a child's geometry, clip, effect, position, orientation, or scale, will cause the group's layout bounds to change. If this movement of the pivot point is not desired, applications should instead use the Node's transforms[] sequence, and add a javafx.scene.transform.Rotate transform, which has a user-specifiable pivot point.

0.0

Profile: common

 
publicrotationAxisPoint3DRotate.Z_AXIS

Defines the axis of rotation of this Node.

Defines the axis of rotation of this Node.

Note: this is a conditional feature. See ConditionalFeature.SCENE3D for more information.

Rotate.Z_AXIS

Profile: common conditional scene3d

 
publicscaleXNumber1.0

Defines the factor by which coordinates are scaled about the center of the object along the X axis of this Node.

Defines the factor by which coordinates are scaled about the center of the object along the X axis of this Node. This is used to stretch or animate the node either manually or by using an animation.

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.0

Profile: common

 
publicscaleYNumber1.0

Defines the factor by which coordinates are scaled about the center of the object along the Y axis of this Node.

Defines the factor by which coordinates are scaled about the center of the object along the Y axis of this Node. This is used to stretch or animate the node either manually or by using an animation.

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.0

Profile: common

 
publicscaleZNumber1.0

Defines the factor by which coordinates are scaled about the center of the object along the Z axis of this Node.

Defines the factor by which coordinates are scaled about the center of the object along the Z axis of this Node. This is used to stretch or animate the node either manually or by using an animation.

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.0

Profile: common conditional scene3d

 
public-read packagesceneScenenull

The Scene that this Node is part of.

The Scene that this Node is part of. If the Node is not part of a scene, then this variable will be null.

null

Profile: common

 
publicstyleStringempty 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 string

Profile: common

 
publicstyleClassStringempty 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 string

Profile: common

 
publictransformsTransform[]empty

Defines the sequence of javafx.scene.transform.Transform objects to be applied to this Node.

Defines the sequence of javafx.scene.transform.Transform objects to be applied to this Node. This sequence of transforms is applied before translateX, translateY, scaleX, and scaleY, rotate transforms.

empty

Profile: common

 
publictranslateXNumber0

Defines the x coordinate of the translation that is added to this Node's transform.

Defines the x coordinate of the translation that is added to this Node's transform.

The node's final translation will be computed as layoutX + translateX, where layoutX establishes the node's stable position and translateX optionally makes dynamic adjustments to that position.

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.

0

Profile: common

 
publictranslateYNumber0

Defines the y coordinate of the translation that is added to this Node's transform.

Defines the y coordinate of the translation that is added to this Node's transform.

The node's final translation will be computed as layoutY + translateY, where layoutY establishes the node's stable position and translateY optionally makes dynamic adjustments to that position.

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.

0

Profile: common

 
publictranslateZNumber0

Defines the Z coordinate of the translation that is added to the transformed coordinates of this Node.

Defines the Z coordinate of the translation that is added to the transformed coordinates of this Node. This value will be added to any translation defined by the transforms sequence and layoutZ.

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.

0

Profile: common conditional scene3d

 
publicvisibleBooleantrue

Specifies whether this Node and any subnodes should be rendered as part of the scene graph.

Specifies whether this Node and any subnodes should be rendered as part of the scene graph. A node may be visible and yet not be shown in the rendered scene if, for instance, it is off the screen or obscured by another Node. Invisible nodes never receive mouse events or keyboard focus, and never maintain keyboard focus when they become invisible.

true

Profile: common

 

javafx.scene.layout.Resizable

accessnametypeCan ReadCan InitCan WriteDefault Valuedescription
publicheightNumber

The Resizable's layout height, which is set by the it's parent during layout and should not be set directly by the application.

The Resizable's layout height, which is set by the it's parent during layout and should not be set directly by the application. Any value set by the application will be overridden by the parent when it lays out the Resizable in accordance with the Resizable's sizing preferences and the parent's layout policy.

If an application needs to control the height of a Resizable node, it should override its preferred height using LayoutInfo:


      Label {
          layoutInfo: LayoutInfo { height: 100 }
      }
 

Profile: common

 
publicwidthNumber

The Resizable's layout width, which is set by the it's parent during layout and should not be set directly by the application.

The Resizable's layout width, which is set by the it's parent during layout and should not be set directly by the application. Any value set by the application will be overridden by the parent when it lays out the Resizable in accordance with the Resizable's sizing preferences and the parent's layout policy.

If an application needs to control the width of a Resizable node, it should override its preferred width using LayoutInfo:


      Label {
          layoutInfo: LayoutInfo { width: 100 }
      }
 

Profile: common

 

javafx.scene.text.TextOffsets

accessnametypeCan ReadCan InitCan WriteDefault Valuedescription
public-read protectedbaselineOffsetNumbersubclasssubclass

The 'alphabetic' (or 'roman') baseline offset from the node's layoutBounds.minY location.

javafx.scene.control.Labeled

accessnametypeCan ReadCan InitCan WriteDefault Valuedescription
publicfontFont

The default font to use for text in the Labeled.

The default font to use for text in the Labeled. If the Label's text is rich text then this font may or may not be used depending on the font information embedded in the rich text, but in any case where a default font is required, this font will be used.

 
publicgraphicNode

An optional icon for the Labeled.

An optional icon for the Labeled. This can be positioned relative to the text by using the graphicHPos and graphicVPos variables. The node specified for this variable cannot appear elsewhere in the scene graph, otherwise the IllegalArgumentException is thrown. See the class description of Node for more detail.

 
publicgraphicHPosHPos

Specifies the horizontal positioning of the graphic relative to the text.

publicgraphicTextGapNumber

The amount of space between the graphic and text

publicgraphicVPosVPos

Specifies the vertical positioning of the graphic relative to the text.

publichposHPos

Specifies how the text and graphic within the Labeled should be positioned horizontally when there is empty space within the Labeled.

publictextString

The text to display in the label.

publictextAlignmentTextAlignment

Specifies the behavior for lines of text when text is multiline Unlike vpos which affects the graphic and text, this setting only affects multiple lines of text relative to the text bounds.

publictextOverrunOverrunStyle

Specifies the behavior to use if the text of the Labeled exceeds the available space for rendering the text.

publictextWrapBoolean

If a run of text exceeds the width of the Labeled, then this variable indicates whether the text should wrap onto another line.

publicvposVPos

Specifies how the text and graphic within the Labeled should be positioned vertically when there is empty space within the Labeled.

Function Summary

public select(item: MenuItem) : Void
Parameters
item
 

Inherited Functions

com.javafx.preview.control.MenuButton

public hide() : Void

Hides the PopupMenu.

Hides the PopupMenu.

 
public show() : Void

Shows the PopupMenu, assuming that it is not disabled.

Shows the PopupMenu, assuming that it is not disabled.

 

javafx.scene.control.ButtonBase

public arm() : Void

Arms the button.

Arms the button. An armed button will fire an action (whether that be the action of a Button or toggling selection on a CheckBox or some other behavior) on the next expected UI gesture.

 
public disarm() : Void

Disarms the button.

Disarms the button. See arm().

 
public abstract fire() : Void

Invoked when a user gesture indicates that an event for this ButtonBase should occur.

Invoked when a user gesture indicates that an event for this ButtonBase should occur. If invoked, this method will be executed regardless of the status of armed

 

javafx.scene.control.Control

public getHFill() : Boolean
Returns
Boolean
 
public getHGrow() : Priority
Returns
Priority
 
public getHShrink() : Priority
Returns
Priority
 
public getMaxHeight() : Number
Returns
Number
 
public getMaxWidth() : Number
Returns
Number
 
public getMinHeight() : Number
Returns
Number
 
public getMinWidth() : Number
Returns
Number
 
public getPrefHeight(width: Number) : Number
Parameters
width
Returns
Number
 
public getPrefWidth(height: Number) : Number
Parameters
height
Returns
Number
 
public getVFill() : Boolean
Returns
Boolean
 
public getVGrow() : Priority
Returns
Priority
 
public getVShrink() : Priority
Returns
Priority
 

javafx.scene.Parent

public layout() : Void

Executes a top-down layout pass on the scene graph under this parent.

Executes a top-down layout pass on the scene graph under this parent.

 
public lookup(id: java.lang.String) : Node
Parameters
id
Returns
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 this Node) is contained within the shape of this Node.

Returns true if the given point (specified in the local coordinate space of this Node) is contained within the shape of this Node. Note that this method does not take visibility into account; the test is based on the geometry of this Node 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 this Node) is contained within the shape of this Node.

Returns true if the given point (specified in the local coordinate space of this Node) is contained within the shape of this Node. Note that this method does not take visibility into account; the test is based on the geometry of this Node 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 this Node) intersects the shape of this Node.

Returns true if the given rectangle (specified in the local coordinate space of this Node) intersects the shape of this Node. Note that this method does not take visibility into account; the test is based on the geometry of this Node 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 this Node) intersects the shape of this Node.

Returns true if the given bounds (specified in the local coordinate space of this Node) intersects the shape of this Node. Note that this method does not take visibility into account; the test is based on the geometry of this Node 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

Transforms a point from the local coordinate space of this Node into the coordinate space of its parent.

Transforms a point from the local coordinate space of this Node into the coordinate space of its parent.

Parameters
localX
localY
Returns
Point2D

Profile: common

 
public localToParent(localPoint: Point2D) : Point2D

Transforms a point from the local coordinate space of this Node into the coordinate space of its parent.

Transforms a point from the local coordinate space of this Node into the coordinate space of its parent.

Parameters
localPoint
Returns
Point2D

Profile: common

 
public localToParent(localBounds: Bounds) : Bounds

Transforms a bounds from the local coordinate space of this Node into the coordinate space of its parent.

Transforms a bounds from the local coordinate space of this Node into the coordinate space of its parent.

Parameters
localBounds
Returns
Bounds

Profile: common

 
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 a Parent, 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 of id .

Profile: common

 
public parentToLocal(parentX: Number, parentY: Number) : Point2D

Transforms a point from the coordinate space of the parent into the local coordinate space of this Node.

Transforms a point from the coordinate space of the parent into the local coordinate space of this Node.

Parameters
parentX
parentY
Returns
Point2D

Profile: common

 
public parentToLocal(parentPoint: Point2D) : Point2D

Transforms a point from the coordinate space of the parent into the local coordinate space of this Node.

Transforms a point from the coordinate space of the parent into the local coordinate space of this Node.

Parameters
parentPoint
Returns
Point2D

Profile: common

 
public parentToLocal(parentBounds: Bounds) : Bounds

Transforms a rectangle from the coordinate space of the parent into the local coordinate space of this Node.

Transforms a rectangle from the coordinate space of the parent into the local coordinate space of this Node.

Parameters
parentBounds
Returns
Bounds

Profile: common

 
public requestFocus() : Void

Requests that this Node get the input focus, and that this Node's top-level ancestor become the focused window.

Requests that this Node get the input focus, and that this Node'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 this Scene'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 a Stage that is both visible and active.

Profile: common

 
public sceneToLocal(sceneX: Number, sceneY: Number) : Point2D

Transforms a point from the coordinate space of the Scene into the local coordinate space of this Node.

Transforms a point from the coordinate space of the Scene into the local coordinate space of this Node.

Parameters
sceneX
sceneY
Returns
Point2D

Profile: common

 
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 this Node to the first position in its parent's content sequence. This function has no effect if this Node 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 this Node to the last position in its parent's content sequence. This function has no effect if this Node is not part of a group.

Profile: common

 
public toString() : java.lang.String
Returns
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's height 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's width 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 the width parameter. Implementations of this function may also choose to ignore width 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 the height parameter. Implementations of this function may also choose to ignore height 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
 

javafx.scene.control.Labeled