I created a simple dialog with radio buttons
<?xml version="1.0" encoding="UTF-8"?>
<?import java.net.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.image.Image?>
<Dialog fx:id="dialog"
    fx:controller="myapp.AddDialogController"
    xmlns:fx="http://javafx.com/fxml">
    <dialogPane>
        <DialogPane prefWidth="400.0" prefHeight="300.0">
            <stylesheets>
                <URL value="@/css/styles.css" />
            </stylesheets>
            <content>
                <VBox>
                    <fx:define>
                        <ToggleGroup fx:id="myToggleGroup"/>
                    </fx:define>
                    <children>
                        <RadioButton text="Comment" toggleGroup="$myToggleGroup"/>
                        <RadioButton text="Survey" toggleGroup="$myToggleGroup"/>
                        <RadioButton text="Suggestion" toggleGroup="$myToggleGroup"/>
                    </children>
                </VBox>
            </content>
        </DialogPane>
    </dialogPane>
</Dialog>
And I create it like this:
private String convertDialogResult(ButtonType buttonType) {
    if (buttonType == ButtonType.OK) {
        return "A";
    } else {
        return null;
    }
}
private Dialog<String> createAddDialog() throws ApplicationException {
    try {
        Dialog<NodeViewModel> dialog = FXMLLoader.load(getClass().getResource("/fxml/add_dialog.fxml"));
        dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);
        dialog.setResultConverter(this::convertDialogResult);
        return dialog;
    } catch (IOException e) {
        throw new ApplicationException(e);
    }
}
But now I'd like not to return "A" all the time, but "A" if "Comment" is selected, "B" if "Survey" is selected, etc.
How can I do it?
 
     
     
    