Example usage for javafx.scene.control SplitMenuButton SplitMenuButton

List of usage examples for javafx.scene.control SplitMenuButton SplitMenuButton

Introduction

In this page you can find the example usage for javafx.scene.control SplitMenuButton SplitMenuButton.

Prototype

public SplitMenuButton() 

Source Link

Document

Creates a new empty split menu button.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Group group = new Group();
    Scene scene = new Scene(group);

    SplitMenuButton m = new SplitMenuButton();
    m.setText("Shutdown");
    m.getItems().addAll(new MenuItem("Logout"), new MenuItem("Sleep"));
    m.setOnAction(new EventHandler<ActionEvent>() {
        @Override/*from ww w.j  a  v  a 2 s .  c  om*/
        public void handle(ActionEvent e) {
            System.out.println("Shutdown");
        }
    });

    group.getChildren().add(m);

    stage.setTitle("Welcome to JavaFX!");
    stage.setScene(scene);
    stage.sizeToScene();
    stage.show();
}