Search in sources :

Example 6 with ButtonChoicePanel

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);
}
Also used : YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel) ButtonChoicePanel(com.mucommander.commons.util.ui.button.ButtonChoicePanel) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton)

Aggregations

ButtonChoicePanel (com.mucommander.commons.util.ui.button.ButtonChoicePanel)6 JButton (javax.swing.JButton)6 YBoxPanel (com.mucommander.commons.util.ui.layout.YBoxPanel)4 JPanel (javax.swing.JPanel)3 MnemonicHelper (com.mucommander.commons.util.ui.helper.MnemonicHelper)2 CollapseExpandButton (com.mucommander.ui.button.CollapseExpandButton)1 SizeChooser (com.mucommander.ui.chooser.SizeChooser)1 BorderLayout (java.awt.BorderLayout)1 Container (java.awt.Container)1 Dimension (java.awt.Dimension)1 ActionEvent (java.awt.event.ActionEvent)1 JCheckBox (javax.swing.JCheckBox)1 JLabel (javax.swing.JLabel)1 JProgressBar (javax.swing.JProgressBar)1