Search in sources :

Example 6 with YBoxPanel

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

the class StatusBarPanel method createPreviewPanel.

private JPanel createPreviewPanel(FontChooser fontChooser) {
    YBoxPanel previewPanel = new YBoxPanel();
    addPreviewLabel(previewPanel, normalPreview = new JLabel(Translator.get("status_bar.selected_files", "3", "14")), "theme_editor.normal", fontChooser);
    normalPreview.setForeground(themeData.getColor(ThemeData.STATUS_BAR_FOREGROUND_COLOR));
    addPreviewLabel(previewPanel, okPreview = new Preview(OK), "theme_editor.free_space.ok", fontChooser);
    addPreviewLabel(previewPanel, warningPreview = new Preview(WARNING), "theme_editor.free_space.warning", fontChooser);
    addPreviewLabel(previewPanel, criticalPreview = new Preview(CRITICAL), "theme_editor.free_space.critical", fontChooser);
    previewPanel.setBorder(BorderFactory.createTitledBorder(Translator.get("preview")));
    Insets insets = previewPanel.getInsets();
    previewPanel.setInsets(new Insets(insets.top, insets.left + 8, insets.bottom, insets.right + 6));
    return previewPanel;
}
Also used : YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel)

Example 7 with YBoxPanel

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

the class RunDialog method createInputArea.

/**
 * Creates the shell input part of the dialog.
 * @return the shell input part of the dialog.
 */
private YBoxPanel createInputArea() {
    YBoxPanel mainPanel;
    JPanel labelPanel;
    mainPanel = new YBoxPanel();
    // Adds a textual description:
    // - if we're working in a local directory, 'run in current folder'.
    // - if we're working on a non-standard FS, 'run in home folder'.
    mainPanel.add(new JLabel(mainFrame.getActivePanel().getCurrentFolder().getURL().getScheme().equals(LocalFile.SCHEMA) ? Translator.get("run_dialog.run_command_description") + ":" : Translator.get("run_dialog.run_in_home_description") + ":"));
    // Adds the shell input combo box.
    mainPanel.add(inputCombo = new ShellComboBox(this));
    inputCombo.setEnabled(true);
    // Adds a textual description of the shell output area.
    mainPanel.addSpace(10);
    labelPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    labelPanel.add(new JLabel(Translator.get("run_dialog.command_output") + ":"));
    labelPanel.add(new JLabel(dial = new SpinningDial()));
    mainPanel.add(labelPanel);
    return mainPanel;
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel) SpinningDial(com.mucommander.ui.icon.SpinningDial) JLabel(javax.swing.JLabel)

Example 8 with YBoxPanel

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

the class ThemeNameDialog method init.

/**
 * Initialises the dialog's UI.
 */
private void init(String name) {
    YBoxPanel panel;
    setMaximumSize(MAXIMUM_DIALOG_DIMENSION);
    // Creates the name panel.
    panel = new YBoxPanel();
    panel.add(createNamePanel(name));
    List<JButton> buttons = Arrays.asList(okButton = new JButton(Translator.get("ok")), cancelButton = new JButton(Translator.get("cancel")));
    // Creates the button panel.
    panel.add(new ButtonChoicePanel(buttons, 2, getRootPane()));
    // TODO rework it to use Action based enums....
    okButton.addActionListener(this);
    cancelButton.addActionListener(this);
    getContentPane().add(panel, BorderLayout.NORTH);
    pack();
}
Also used : YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel) ButtonChoicePanel(com.mucommander.commons.util.ui.button.ButtonChoicePanel) JButton(javax.swing.JButton)

Example 9 with YBoxPanel

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

the class BatchRenameDialog method getPnlTop.

/**
 * Creates a panel with edit controls.
 */
private JPanel getPnlTop() {
    // file & extension mask
    edtFileNameMask = new JTextField("[N].[E]");
    edtFileNameMask.setColumns(20);
    edtFileNameMask.getDocument().addDocumentListener(this);
    edtFileNameMask.setToolTipText(getPatternHelp());
    // search & replace
    edtSearchFor = new JTextField();
    edtSearchFor.setColumns(20);
    edtSearchFor.getDocument().addDocumentListener(this);
    edtReplaceWith = new JTextField();
    edtReplaceWith.setColumns(20);
    edtReplaceWith.getDocument().addDocumentListener(this);
    // upper/lower case
    Vector<String> ulcase = new Vector<String>();
    ulcase.add(Translator.get("batch_rename_dialog.no_change"));
    ulcase.add(Translator.get("batch_rename_dialog.lower_case"));
    ulcase.add(Translator.get("batch_rename_dialog.upper_case"));
    ulcase.add(Translator.get("batch_rename_dialog.first_upper"));
    ulcase.add(Translator.get("batch_rename_dialog.word"));
    cbCase = new JComboBox<>(ulcase);
    cbCase.addActionListener(this);
    // counter
    edtCounterStart = new JTextField("1");
    edtCounterStart.getDocument().addDocumentListener(this);
    edtCounterStart.setColumns(2);
    edtCounterStep = new JTextField("1");
    edtCounterStep.getDocument().addDocumentListener(this);
    edtCounterStep.setColumns(2);
    Vector<String> digits = new Vector<String>();
    String zeros = "0000";
    for (int i = 1; i <= 5; i++) {
        digits.add(zeros.substring(0, i - 1) + "1");
    }
    cbCounterDigits = new JComboBox<>(digits);
    cbCounterDigits.addActionListener(this);
    // add controls
    XBoxPanel pnlTop = new XBoxPanel();
    YBoxPanel pnl1 = new YBoxPanel();
    pnl1.setBorder(BorderFactory.createTitledBorder(Translator.get("batch_rename_dialog.mask")));
    pnl1.add(edtFileNameMask);
    JPanel pnl1Btns = new JPanel(new GridLayout(3, 2));
    btnName = new JButton("[N] - " + Translator.get("name"));
    btnName.addActionListener(this);
    btnName.setHorizontalAlignment(SwingConstants.LEFT);
    pnl1Btns.add(btnName);
    btnExtension = new JButton("[E] - " + Translator.get("extension"));
    btnExtension.addActionListener(this);
    btnExtension.setHorizontalAlignment(SwingConstants.LEFT);
    pnl1Btns.add(btnExtension);
    btnNameRange = new JButton("[N#-#] - " + Translator.get("batch_rename_dialog.range"));
    btnNameRange.addActionListener(this);
    btnNameRange.setHorizontalAlignment(SwingConstants.LEFT);
    pnl1Btns.add(btnNameRange);
    btnCounter = new JButton("[C] - " + Translator.get("batch_rename_dialog.counter"));
    btnCounter.addActionListener(this);
    btnCounter.setHorizontalAlignment(SwingConstants.LEFT);
    pnl1Btns.add(btnCounter);
    pnl1.add(pnl1Btns);
    pnl1.add(new JPanel());
    pnlTop.add(pnl1);
    XAlignedComponentPanel pnl2 = new XAlignedComponentPanel(5);
    pnl2.setBorder(BorderFactory.createTitledBorder(Translator.get("batch_rename_dialog.search_replace")));
    pnl2.addRow(Translator.get("batch_rename_dialog.search_for"), edtSearchFor, 5);
    pnl2.addRow(Translator.get("batch_rename_dialog.replace_with"), edtReplaceWith, 5);
    pnl2.addRow(Translator.get("batch_rename_dialog.upper_lower_case"), cbCase, 5);
    pnlTop.add(pnl2);
    XAlignedComponentPanel pnl3 = new XAlignedComponentPanel(5);
    pnl3.setBorder(BorderFactory.createTitledBorder(Translator.get("batch_rename_dialog.counter") + " [C]"));
    pnl3.addRow(Translator.get("batch_rename_dialog.start_at"), edtCounterStart, 5);
    pnl3.addRow(Translator.get("batch_rename_dialog.step_by"), edtCounterStep, 5);
    pnl3.addRow(Translator.get("batch_rename_dialog.format"), cbCounterDigits, 5);
    pnlTop.add(pnl3);
    return pnlTop;
}
Also used : GridLayout(java.awt.GridLayout) XBoxPanel(com.mucommander.commons.util.ui.layout.XBoxPanel) XAlignedComponentPanel(com.mucommander.commons.util.ui.layout.XAlignedComponentPanel) YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel)

Example 10 with YBoxPanel

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

the class InitialSetupDialog method createLookAndFeelPanel.

/**
 * Creates the dialog's look and feel panel.
 * @return the dialog's look and feel panel.
 */
private JPanel createLookAndFeelPanel() {
    // Initialises the theme panel.
    // Look and feel panel.
    JPanel lfPanel = new YBoxPanel();
    lfPanel.setAlignmentX(LEFT_ALIGNMENT);
    lfPanel.setBorder(BorderFactory.createTitledBorder(Translator.get("prefs_dialog.look_and_feel")));
    // 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.look_and_feel") + ':'));
    lfPanel.add(tempPanel);
    // Initializes the L&F combo box.
    lfComboBox = new JComboBox<>();
    lfInfo = UIManager.getInstalledLookAndFeels();
    // Name of the current look&feel.
    String currentLf = UIManager.getLookAndFeel().getClass().getName();
    // Index of the current look and feel in the list.
    int selectedIndex = -1;
    // Goes through all available look&feels and selects the current one.
    for (int i = 0; i < lfInfo.length; i++) {
        // Buffer for look&feel names.
        String className = lfInfo[i].getClassName();
        // Tries to select current L&F
        if (currentLf.equals(className))
            selectedIndex = i;
        else // so we need this test
        if (selectedIndex == -1 && (currentLf.startsWith(className) || className.startsWith(currentLf)))
            selectedIndex = i;
        lfComboBox.addItem(lfInfo[i].getName());
    }
    // If no match, selects first one
    if (selectedIndex == -1)
        selectedIndex = 0;
    lfComboBox.setSelectedIndex(selectedIndex);
    lfComboBox.addActionListener(this);
    lfPanel.add(lfComboBox);
    return lfPanel;
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel) JLabel(javax.swing.JLabel)

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