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(new EventHandler() { @Override public void handle(ActionEvent e) { System.out.println("Shutdown"); } });
MnemonicParsing is enabled by default for SplitMenuButton.
extends