The DialogPane
has this implementation in SceneBuilder
:
You can add to the Pane a list of buttons.
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));
}
}
}
}
});
}
DialogPane
as a special case (in which you are probably out of luck), or if it looks for something specific (a read only property which has a type that has some constants defined of the same type, or something...). – Pelton