Search in sources :

Example 11 with YBoxPanel

use of com.mucommander.commons.util.ui.layout.YBoxPanel in project mucommander by mucommander.

the class InitialSetupDialog method createThemePanel.

// - Initialisation ------------------------------------------------------------------
// -----------------------------------------------------------------------------------
/**
 * Creates the dialog's theme panel.
 * @return the dialog's theme panel.
 */
private JPanel createThemePanel() {
    // Initialises the theme panel.
    // Theme panel.
    JPanel themePanel = new YBoxPanel();
    themePanel.setAlignmentX(LEFT_ALIGNMENT);
    themePanel.setBorder(BorderFactory.createTitledBorder(Translator.get("prefs_dialog.themes")));
    // Adds the panel description.
    // Temporary panel used to hold the dialog's description.
    JPanel tempPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    tempPanel.add(new JLabel(Translator.get("setup.theme") + ':'));
    themePanel.add(tempPanel);
    // Adds the theme combo box.
    themeComboBox = new JComboBox<>();
    // All available themes.
    Iterator<Theme> themes = ThemeManager.availableThemes();
    // Index of the currently analyzed theme.
    int index = 0;
    // Index of the current theme in the combo box.
    int selectedIndex = 0;
    // Adds all themes to the combo box.
    while (themes.hasNext()) {
        Theme theme = themes.next();
        themeComboBox.addItem(theme);
        if (ThemeManager.isCurrentTheme(theme))
            selectedIndex = index;
        index++;
    }
    // Selects the current theme.
    themeComboBox.setSelectedIndex(selectedIndex);
    themeComboBox.addActionListener(this);
    themePanel.add(themeComboBox);
    return themePanel;
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel) JLabel(javax.swing.JLabel) Theme(com.mucommander.ui.theme.Theme)

Example 12 with YBoxPanel

use of com.mucommander.commons.util.ui.layout.YBoxPanel in project mucommander by mucommander.

the class AppearancePanel method createLookAndFeelPanel.

/**
 * Creates the look and feel panel.
 *
 * @return the look and feel panel.
 */
private JPanel createLookAndFeelPanel() {
    JPanel lnfPanel;
    // Creates the panel.
    lnfPanel = new YBoxPanel();
    lnfPanel.setAlignmentX(LEFT_ALIGNMENT);
    lnfPanel.setBorder(BorderFactory.createTitledBorder(Translator.get("prefs_dialog.look_and_feel")));
    // Creates the look and feel combo box.
    lookAndFeelComboBox = new PrefComboBox() {

        public boolean hasChanged() {
            int selectedIndex = getSelectedIndex();
            if (selectedIndex < 0)
                return false;
            return !lookAndFeels[selectedIndex].getClassName().equals(MuConfigurations.getPreferences().getVariable(MuPreference.LOOK_AND_FEEL));
        }
    };
    lookAndFeelComboBox.setRenderer(new BasicComboBoxRenderer() {

        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            JLabel label;
            label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            if (index < 0)
                return label;
            // All look and feels that are not modifiable must be flagged with a lock icon.
            if (isLookAndFeelModifiable(lookAndFeels[index]))
                label.setIcon(transparentIcon);
            else
                label.setIcon(lockIcon);
            return label;
        }
    });
    // Populates the look and feel combo box.
    populateLookAndFeels();
    // Initialises buttons and event listening.
    importLookAndFeelButton = new JButton(Translator.get("prefs_dialog.import") + "...");
    deleteLookAndFeelButton = new JButton(Translator.get("delete"));
    importLookAndFeelButton.addActionListener(this);
    deleteLookAndFeelButton.addActionListener(this);
    resetLookAndFeelButtons();
    lookAndFeelComboBox.addActionListener(this);
    // Adds the look and feel list and the action buttons to the panel.
    JPanel flowPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    flowPanel.add(lookAndFeelComboBox);
    flowPanel.add(importLookAndFeelButton);
    flowPanel.add(deleteLookAndFeelButton);
    flowPanel.add(new JLabel(dial = new SpinningDial()));
    lnfPanel.add(flowPanel);
    return lnfPanel;
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) BasicComboBoxRenderer(javax.swing.plaf.basic.BasicComboBoxRenderer) YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel) PrefComboBox(com.mucommander.ui.dialog.pref.component.PrefComboBox) SpinningDial(com.mucommander.ui.icon.SpinningDial) Component(java.awt.Component) JList(javax.swing.JList)

Example 13 with YBoxPanel

use of com.mucommander.commons.util.ui.layout.YBoxPanel in project mucommander by mucommander.

the class QuestionDialog method init.

protected void init(Component comp, String[] actionText, int[] actionValues, int maxNbCols) {
    this.actionValues = actionValues;
    // 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);
    }
    int nbButtons = actionText.length;
    buttons = new JButton[nbButtons];
    String text;
    for (int i = 0; i < nbButtons; i++) {
        text = actionText[i];
        buttons[i] = new JButton(text);
        buttons[i].addActionListener(this);
    }
    setInitialFocusComponent(buttons[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) JButton(javax.swing.JButton)

Example 14 with YBoxPanel

use of com.mucommander.commons.util.ui.layout.YBoxPanel in project mucommander by mucommander.

the class ProgressDialog method initUI.

private void initUI() {
    Container contentPane = getContentPane();
    totalProgressBar = new JProgressBar();
    totalProgressBar.setStringPainted(true);
    totalProgressBar.setAlignmentX(LEFT_ALIGNMENT);
    currentFileLabel = new JLabel(job.getStatusString());
    currentFileLabel.setAlignmentX(LEFT_ALIGNMENT);
    YBoxPanel yPanel = new YBoxPanel();
    // 2 progress bars
    if (transferFileJob != null) {
        yPanel.add(currentFileLabel);
        currentFileProgressBar = new JProgressBar();
        currentFileProgressBar.setStringPainted(true);
        yPanel.add(currentFileProgressBar);
        yPanel.addSpace(10);
        totalTransferredLabel = new JLabel(Translator.get("progress_dialog.starting"));
        yPanel.add(totalTransferredLabel);
        yPanel.add(totalProgressBar);
    } else // Single progress bar
    {
        yPanel.add(currentFileLabel);
        yPanel.add(totalProgressBar);
    }
    yPanel.addSpace(10);
    elapsedTimeLabel = new JLabel(Translator.get("progress_dialog.elapsed_time") + ": ");
    elapsedTimeLabel.setIcon(IconManager.getIcon(IconManager.STATUS_BAR_ICON_SET, StatusBar.WAITING_ICON));
    yPanel.add(elapsedTimeLabel);
    if (transferFileJob != null) {
        JPanel tempPanel = new JPanel(new BorderLayout());
        this.currentSpeedLabel = new JLabel();
        updateCurrentSpeedLabel("");
        currentSpeedLabel.setIcon(IconManager.getIcon(IconManager.PROGRESS_ICON_SET, CURRENT_SPEED_ICON));
        tempPanel.add(currentSpeedLabel, BorderLayout.WEST);
        YBoxPanel advancedPanel = new YBoxPanel();
        this.speedGraph = new SpeedGraph();
        speedGraph.setPreferredSize(new Dimension(0, SPEED_GRAPH_HEIGHT));
        advancedPanel.add(speedGraph);
        advancedPanel.addSpace(5);
        JPanel tempPanel2 = new JPanel(new BorderLayout());
        this.limitSpeedCheckBox = new JCheckBox(Translator.get("progress_dialog.limit_speed") + ":", false);
        limitSpeedCheckBox.addItemListener(this);
        tempPanel2.add(limitSpeedCheckBox, BorderLayout.WEST);
        speedChooser = new SizeChooser(true);
        speedChooser.setEnabled(false);
        speedChooser.addChangeListener(this);
        tempPanel2.add(speedChooser, BorderLayout.EAST);
        advancedPanel.add(tempPanel2);
        advancedPanel.addSpace(5);
        this.collapseExpandButton = new CollapseExpandButton(Translator.get("progress_dialog.advanced"), advancedPanel, true);
        collapseExpandButton.setExpandedState(MuConfigurations.getPreferences().getVariable(MuPreference.PROGRESS_DIALOG_EXPANDED, MuPreferences.DEFAULT_PROGRESS_DIALOG_EXPANDED));
        tempPanel.add(collapseExpandButton, BorderLayout.EAST);
        yPanel.add(tempPanel);
        yPanel.addSpace(5);
        yPanel.add(advancedPanel);
    }
    closeWhenFinishedCheckBox = new JCheckBox(Translator.get("progress_dialog.close_when_finished"));
    closeWhenFinishedCheckBox.setSelected(MuConfigurations.getPreferences().getVariable(MuPreference.PROGRESS_DIALOG_CLOSE_WHEN_FINISHED, MuPreferences.DEFAULT_PROGRESS_DIALOG_CLOSE_WHEN_FINISHED));
    yPanel.add(closeWhenFinishedCheckBox);
    yPanel.add(Box.createVerticalGlue());
    contentPane.add(yPanel, BorderLayout.CENTER);
    pauseResumeButton = new JButton(Translator.get("pause"), IconManager.getIcon(IconManager.PROGRESS_ICON_SET, PAUSE_ICON));
    pauseResumeButton.addActionListener(this);
    if (transferFileJob != null) {
        skipButton = new JButton(Translator.get("skip"), IconManager.getIcon(IconManager.PROGRESS_ICON_SET, SKIP_ICON));
        skipButton.addActionListener(this);
    }
    stopButton = new JButton(Translator.get("stop"), IconManager.getIcon(IconManager.PROGRESS_ICON_SET, STOP_ICON));
    stopButton.addActionListener(this);
    hideButton = new JButton(Translator.get("progress_dialog.hide"), IconManager.getIcon(IconManager.PROGRESS_ICON_SET, HIDE_ICON));
    hideButton.addActionListener(this);
    this.buttonsChoicePanel = new ButtonChoicePanel(skipButton == null ? Arrays.asList(pauseResumeButton, stopButton, hideButton) : Arrays.asList(pauseResumeButton, skipButton, stopButton, hideButton), 0, getRootPane());
    contentPane.add(buttonsChoicePanel, BorderLayout.SOUTH);
    // Cancel button receives initial focus
    setInitialFocusComponent(stopButton);
    // Enter triggers cancel button
    getRootPane().setDefaultButton(stopButton);
}
Also used : JPanel(javax.swing.JPanel) ButtonChoicePanel(com.mucommander.commons.util.ui.button.ButtonChoicePanel) JProgressBar(javax.swing.JProgressBar) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) JCheckBox(javax.swing.JCheckBox) Container(java.awt.Container) YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel) BorderLayout(java.awt.BorderLayout) SizeChooser(com.mucommander.ui.chooser.SizeChooser) CollapseExpandButton(com.mucommander.ui.button.CollapseExpandButton)

Example 15 with YBoxPanel

use of com.mucommander.commons.util.ui.layout.YBoxPanel in project mucommander by mucommander.

the class AppearancePanel method initUI.

// - UI initialisation ------------------------------------------------------
// --------------------------------------------------------------------------
private void initUI() {
    YBoxPanel mainPanel;
    mainPanel = new YBoxPanel();
    // Look and feel.
    mainPanel.add(createLookAndFeelPanel());
    mainPanel.add(Box.createRigidArea(new Dimension(0, 10)));
    // Themes.
    mainPanel.add(createThemesPanel());
    mainPanel.add(Box.createRigidArea(new Dimension(0, 10)));
    // System icons.
    mainPanel.add(createSystemIconsPanel());
    mainPanel.add(Box.createVerticalGlue());
    // Icon size.
    mainPanel.add(createIconSizePanel());
    mainPanel.add(Box.createRigidArea(new Dimension(0, 10)));
    setLayout(new BorderLayout());
    add(mainPanel, BorderLayout.NORTH);
    lookAndFeelComboBox.addDialogListener(parent);
    themeComboBox.addDialogListener(parent);
    useSystemFileIconsComboBox.addDialogListener(parent);
    toolbarIconsSizeComboBox.addDialogListener(parent);
    commandBarIconsSizeComboBox.addDialogListener(parent);
    fileIconsSizeComboBox.addDialogListener(parent);
}
Also used : YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel) BorderLayout(java.awt.BorderLayout) Dimension(java.awt.Dimension)

Aggregations

YBoxPanel (com.mucommander.commons.util.ui.layout.YBoxPanel)26 JPanel (javax.swing.JPanel)11 JButton (javax.swing.JButton)8 JLabel (javax.swing.JLabel)7 FlowLayout (java.awt.FlowLayout)6 ButtonChoicePanel (com.mucommander.commons.util.ui.button.ButtonChoicePanel)4 ProportionalGridPanel (com.mucommander.commons.util.ui.layout.ProportionalGridPanel)4 FontChooser (com.mucommander.ui.chooser.FontChooser)4 BorderLayout (java.awt.BorderLayout)4 ActionEvent (java.awt.event.ActionEvent)3 JCheckBox (javax.swing.JCheckBox)3 JScrollPane (javax.swing.JScrollPane)3 XAlignedComponentPanel (com.mucommander.commons.util.ui.layout.XAlignedComponentPanel)2 CollapseExpandButton (com.mucommander.ui.button.CollapseExpandButton)2 SpinningDial (com.mucommander.ui.icon.SpinningDial)2 InformationPane (com.mucommander.ui.layout.InformationPane)2 Container (java.awt.Container)2 Dimension (java.awt.Dimension)2 ActionListener (java.awt.event.ActionListener)2 WindowAdapter (java.awt.event.WindowAdapter)2