import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.CustomMenuItem; import javafx.scene.control.Label; import javafx.scene.control.MenuItem; import javafx.scene.control.SplitMenuButton; import javafx.scene.layout.HBox; import javafx.stage.Stage; public class Main extends Application { public static void main(String[] args) { launch(args); } @Override public void start(final Stage stage) { HBox root = new HBox(); final Scene scene = new Scene(root); stage.setWidth(600); stage.setHeight(200); stage.setScene(scene); String cssPath = "test.css"; scene.getStylesheets().addAll(cssPath); final SplitMenuButton smb = new SplitMenuButton(); smb.setOnAction(new EventHandler() { public void handle(ActionEvent e) { smb.show(); } }); smb.setText("SplitMenuButton"); smb.setStyle("-fx-background-color: -pal-SystemBlue;"); HBox box = new HBox(); box.getChildren().add(new Label("Just a test")); box.setStyle("-fx-background-color: -pal-SystemBlue;"); CustomMenuItem cmi = new CustomMenuItem(); cmi.setContent(box); smb.getItems().add(cmi); smb.getItems().add(new MenuItem("Test 1 2 3....")); root.getChildren().addAll(smb); stage.show(); } }