private HBox getCustomButtons(String[] buttonLabels, T[] buttonValues, boolean addCancelButton) {
            if (buttonLabels == null || buttonValues == null) throw new NullPointerException("null argument");
            if (buttonLabels.length != buttonValues.length) throw new IllegalArgumentException("different length");
            
            HBox box = getButtonsHBox();
            
            for (int i = 0; i < buttonLabels.length; i++) {
                String label = buttonLabels[i];
                final T buttonResult = buttonValues[i];
                
                Button button = new Button(label);
                button.setOnAction(new EventHandler<ActionEvent>() {
                    @Override
                    public void handle(ActionEvent event) {
                        result = Result.OK;
                        customResult = buttonResult;
                        requestClose();
                    }
                });
                
                box.getChildren().add(button);
            }
            
            if (addCancelButton) {
                box.getChildren().add(getCancelButton());
            }
            
            return box;
        }