How to enable a dropdown list of predetermined items to add to a custom control in SceneBuilder?

Viewed 255

The DialogPane has this implementation in SceneBuilder:

You can add to the Pane a list of buttons.

enter image description here

I am looking to do this for my custom control in scenebuilder. I could not find anything obvious inside the constructor for DialogPane that would make this work.

Is doing this a possibility?

private final ObservableList<ButtonType> buttons = FXCollections.observableArrayList();

public DialogPane() {
    getStyleClass().add("dialog-pane");

    headerTextPanel = new GridPane();
    getChildren().add(headerTextPanel);

    graphicContainer = new StackPane();

    contentLabel = createContentLabel("");
    getChildren().add(contentLabel);

    buttonBar = createButtonBar();
    if (buttonBar != null) {
        getChildren().add(buttonBar);
    }
    buttons.addListener((ListChangeListener<ButtonType>) c -> {
        while (c.next()) {
            if (c.wasRemoved()) {
                for (ButtonType cmd : c.getRemoved()) {
                    buttonNodes.remove(cmd);
                }
            }
            if (c.wasAdded()) {
                for (ButtonType cmd : c.getAddedSubList()) {
                    if (! buttonNodes.containsKey(cmd)) {
                        buttonNodes.put(cmd, createButton(cmd));
                    }
                }
            }
        }
    });
}
1 Answers
Related