Top Description Fields Constructors Methods
javafx.scene.control

public Class SplitMenuButton

extends MenuButton
Class Inheritance
Imports
javafx.event.ActionEvent, javafx.scene.AccessibleAction, .AccessibleAttribute, .AccessibleRole, .Node, javafx.scene.control.skin.SplitMenuButtonSkin

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

Note that the SplitMenuButton does not automatically assign whatever was last selected in the menu to be the action should the action region be clicked.

Example:

 SplitMenuButton m = new SplitMenuButton();
m.setText("Shutdown");
m.getItems().addAll(new MenuItem("Logout"), new MenuItem("Sleep"));
m.setOnAction(e -> System.out.println("Shutdown"));
Image of the SplitMenuButton control

MnemonicParsing is enabled by default for SplitMenuButton.

Since
JavaFX 2.0
See Also
MenuItem, Menu

Field Summary

Modifier and TypeField and Description
private static final String
Inherited from javafx.scene.control.MenuButton:
ON_HIDDENON_HIDINGON_SHOWINGON_SHOWN

Constructor Summary

AccessConstructor and Description
public
SplitMenuButton()

Creates a new empty split menu button.

public
SplitMenuButton(String
the text to display on the menu button
text
)

Creates a new empty split menu button with the given text to display on the button.

public
SplitMenuButton(String
the text to display on the menu button
text
,
Node
the graphic to display on the menu button
graphic
)

Creates a new empty split menu button with the given text and graphic to display on the button.

public
SplitMenuButton(MenuItem...
The items to show within this button's menu
items
)

Creates a new split menu button with the given list of menu items.

public
SplitMenuButton(String
the text to display on the menu button
text
,
Node
the graphic to display on the menu button
graphic
,
MenuItem...
the items to display in the popup menu
items
)

Creates a new split menu button with the given text and graphic to display on the button, and inserts the given items into the items list.

Method Summary

Modifier and TypeMethod and Description
protected Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.MenuButton.createDefaultSkin.

Create a new instance of the default skin for this control.

public void
executeAccessibleAction(AccessibleAction action, Object... parameters)

Overrides javafx.scene.control.MenuButton.executeAccessibleAction.

This method is called by the assistive technology to request the action indicated by the argument should be executed.

public void
fire()

Overrides javafx.scene.control.MenuButton.fire.

Call the action when button is pressed.

public Object
queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters)

Overrides javafx.scene.control.Control.queryAccessibleAttribute.

This method is called by the assistive technology to request the value for an attribute.

Inherited from javafx.scene.control.MenuButton:
getItemsgetOnHiddengetOnHidinggetOnShowinggetOnShowngetPopupSidehideisShowingonHiddenPropertyonHidingPropertyonShowingPropertyonShownPropertypopupSidePropertysetOnHiddensetOnHidingsetOnShowingsetOnShownsetPopupSideshowshowingProperty

Field Detail

DEFAULT_STYLE_CLASSback to summary
private static final String DEFAULT_STYLE_CLASS

Hides javafx.scene.control.MenuButton.DEFAULT_STYLE_CLASS.

Constructor Detail

SplitMenuButtonback to summary
public SplitMenuButton()

Creates a new empty split menu button. Use setText(String), setGraphic(Node) and getItems() to set the content.

SplitMenuButtonback to summary
public SplitMenuButton(String text)

Creates a new empty split menu button with the given text to display on the button. Use setGraphic(Node) and getItems() to set the content.

Parameters
text:String

the text to display on the menu button

Since
24
SplitMenuButtonback to summary
public SplitMenuButton(String text, Node graphic)

Creates a new empty split menu button with the given text and graphic to display on the button. Use getItems() to set the content.

Parameters
text:String

the text to display on the menu button

graphic:Node

the graphic to display on the menu button

Since
24
SplitMenuButtonback to summary
public SplitMenuButton(MenuItem... items)

Creates a new split menu button with the given list of menu items.

Parameters
items:MenuItem[]

The items to show within this button's menu

SplitMenuButtonback to summary
public SplitMenuButton(String text, Node graphic, MenuItem... items)

Creates a new split menu button with the given text and graphic to display on the button, and inserts the given items into the items list.

Parameters
text:String

the text to display on the menu button

graphic:Node

the graphic to display on the menu button

items:MenuItem[]

the items to display in the popup menu

Since
24

Method Detail

createDefaultSkinback to summary
protected Skin<?> createDefaultSkin()

Overrides javafx.scene.control.MenuButton.createDefaultSkin.

Doc from javafx.scene.control.MenuButton.createDefaultSkin.

Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).

Annotations
@Override
executeAccessibleActionback to summary
public void executeAccessibleAction(AccessibleAction action, Object... parameters)

Overrides javafx.scene.control.MenuButton.executeAccessibleAction.

Doc from javafx.scene.control.MenuButton.executeAccessibleAction.

This method is called by the assistive technology to request the action indicated by the argument should be executed.

This method is commonly overridden by subclasses to implement action that are required for a specific role.
If a particular action is not handled, the superclass implementation must be called.

Annotations
@Override
fireback to summary
public void fire()

Overrides javafx.scene.control.MenuButton.fire.

Call the action when button is pressed.

Annotations
@Override
queryAccessibleAttributeback to summary
public Object queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters)

Overrides javafx.scene.control.Control.queryAccessibleAttribute.

Doc from javafx.scene.control.Control.queryAccessibleAttribute.

This method is called by the assistive technology to request the value for an attribute.

This method is commonly overridden by subclasses to implement attributes that are required for a specific role.
If a particular attribute is not handled, the superclass implementation must be called.

Annotations
@Override