use of com.mucommander.commons.util.ui.button.ButtonChoicePanel in project mucommander by mucommander.
the class QuestionDialog method init.
protected void init(Component comp, List<DialogAction> actionChoices, int maxNbCols) {
this.actionChoices.addAll(actionChoices);
// Sets minimum and maximum dimensions for this dialog
setMinimumSize(MINIMUM_DIALOG_DIMENSION);
setMaximumSize(MAXIMUM_DIALOG_DIMENSION);
mainPanel = new YBoxPanel();
if (comp != null) {
mainPanel.addSpace(5);
mainPanel.add(comp);
mainPanel.addSpace(10);
}
for (DialogAction action : actionChoices) {
JButton button = new JButton(action.getActionName());
button.setToolTipText(action.getActionName());
button.addActionListener((ActionEvent event) -> {
retValue = action;
dispose();
});
buttons.add(button);
}
if (!buttons.isEmpty()) {
setInitialFocusComponent(buttons.get(0));
}
mainPanel.add(new ButtonChoicePanel(buttons, maxNbCols, getRootPane()));
getContentPane().add(mainPanel, BorderLayout.NORTH);
}
Aggregations