Search in sources :

Example 1 with PreviewLabel

use of com.mucommander.ui.chooser.PreviewLabel in project mucommander by mucommander.

the class QuickListPanel method createItemColorsPanel.

// - UI initialization ---------------------------------------------------------------
// -----------------------------------------------------------------------------------
/**
 * Creates the JPanel that contains all of the item's color configuration elements.
 * @param fontChooser font chooser used by the editor panel.
 * @return the JPanel that contains all of the item's color configuration elements.
 */
private JPanel createItemColorsPanel(FontChooser fontChooser) {
    // Contains all the color buttons.
    ProportionalGridPanel gridPanel;
    // Used to wrap the colors panel in a flow layout.
    JPanel colorsPanel;
    PreviewLabel label;
    // Initialisation.
    gridPanel = new ProportionalGridPanel(3);
    // Header.
    addLabelRow(gridPanel, false);
    label = new PreviewLabel();
    // Color buttons.
    addColorButtons(gridPanel, fontChooser, "theme_editor.normal", ThemeData.QUICK_LIST_ITEM_FOREGROUND_COLOR, ThemeData.QUICK_LIST_ITEM_BACKGROUND_COLOR, label).addPropertyChangeListener(this);
    addColorButtons(gridPanel, fontChooser, "theme_editor.selected", ThemeData.QUICK_LIST_SELECTED_ITEM_FOREGROUND_COLOR, ThemeData.QUICK_LIST_SELECTED_ITEM_BACKGROUND_COLOR, label).addPropertyChangeListener(this);
    label.addPropertyChangeListener(this);
    // Wraps everything in a flow layout.
    colorsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    colorsPanel.add(gridPanel);
    colorsPanel.setBorder(BorderFactory.createTitledBorder(Translator.get("theme_editor.colors")));
    return colorsPanel;
}
Also used : JPanel(javax.swing.JPanel) PreviewLabel(com.mucommander.ui.chooser.PreviewLabel) FlowLayout(java.awt.FlowLayout) ProportionalGridPanel(com.mucommander.commons.util.ui.layout.ProportionalGridPanel)

Example 2 with PreviewLabel

use of com.mucommander.ui.chooser.PreviewLabel in project mucommander by mucommander.

the class QuickListPanel method createHeaderColorsPanel.

/**
 * Creates the JPanel that contains all of the header's color configuration elements.
 * @param fontChooser font chooser used by the editor panel.
 * @return the JPanel that contains all of the header's color configuration elements.
 */
private JPanel createHeaderColorsPanel(FontChooser fontChooser) {
    // Contains all the color buttons.
    ProportionalGridPanel gridPanel;
    // Used to wrap the colors panel in a flow layout.
    JPanel colorsPanel;
    PreviewLabel label;
    // Initialization.
    gridPanel = new ProportionalGridPanel(3);
    // Header.
    addLabelRow(gridPanel, false);
    label = new PreviewLabel();
    // Color buttons.
    addColorButtons(gridPanel, fontChooser, "", ThemeData.QUICK_LIST_HEADER_FOREGROUND_COLOR, ThemeData.QUICK_LIST_HEADER_BACKGROUND_COLOR, label).addPropertyChangeListener(this);
    label.addPropertyChangeListener(this);
    gridPanel.add(createCaptionLabel(""));
    gridPanel.add(new JLabel());
    PreviewLabel label3 = new PreviewLabel();
    ColorButton butt;
    // .addPropertyChangeListener(this);
    gridPanel.add(butt = new ColorButton(parent, themeData, ThemeData.QUICK_LIST_HEADER_SECONDARY_BACKGROUND_COLOR, PreviewLabel.BACKGROUND_COLOR_PROPERTY_NAME, label3));
    label3.setTextPainted(true);
    label3.addPropertyChangeListener(this);
    butt.addUpdatedPreviewComponent(label3);
    // Wraps everything in a flow layout.
    colorsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    colorsPanel.add(gridPanel);
    colorsPanel.setBorder(BorderFactory.createTitledBorder(Translator.get("theme_editor.colors")));
    return colorsPanel;
}
Also used : JPanel(javax.swing.JPanel) PreviewLabel(com.mucommander.ui.chooser.PreviewLabel) FlowLayout(java.awt.FlowLayout) JLabel(javax.swing.JLabel) ProportionalGridPanel(com.mucommander.commons.util.ui.layout.ProportionalGridPanel)

Example 3 with PreviewLabel

use of com.mucommander.ui.chooser.PreviewLabel in project mucommander by mucommander.

the class StatusBarPanel method createFreeSpacePanel.

private JPanel createFreeSpacePanel(FontChooser chooser, ColorButton foreground, ColorButton background, ColorButton border) {
    JPanel colorPanel = new ProportionalGridPanel(2);
    colorPanel.add(new JLabel());
    colorPanel.add(createCaptionLabel("theme_editor.color"));
    colorPanel.add(createCaptionLabel("theme_editor.background"));
    colorPanel.add(background);
    colorPanel.add(createCaptionLabel("theme_editor.border"));
    colorPanel.add(border);
    for (int i = 0; i < 3; i++) {
        PreviewLabel previewLabel = new PreviewLabel();
        previewLabel.setOverlayUnderText(true);
        previewLabel.setTextPainted(true);
        foreground.addUpdatedPreviewComponent(previewLabel);
        background.addUpdatedPreviewComponent(previewLabel);
        border.addUpdatedPreviewComponent(previewLabel);
        addFontChooserListener(chooser, previewLabel);
        colorPanel.add(createCaptionLabel(WARNING_LEVEL_LABELS[i]));
        colorPanel.add(new ColorButton(parent, themeData, WARNING_LEVEL_COLOR_IDS[i], PreviewLabel.OVERLAY_COLOR_PROPERTY_NAME, previewLabel));
        previewLabel.addPropertyChangeListener(this);
    }
    JPanel flowPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    flowPanel.add(colorPanel);
    return flowPanel;
}
Also used : PreviewLabel(com.mucommander.ui.chooser.PreviewLabel) ProportionalGridPanel(com.mucommander.commons.util.ui.layout.ProportionalGridPanel)

Example 4 with PreviewLabel

use of com.mucommander.ui.chooser.PreviewLabel in project mucommander by mucommander.

the class ThemeEditorPanel method addColorButtons.

/**
 * Adds color buttons to the specified panel.
 * <p>
 * This method will create a row containing the following items:
 * <pre>
 * LABEL | COLOR (foreground) | COLOR (background)
 * </pre>
 * </p>
 * @param gridPanel    a 3 columns proportinal grid panel in which to add the buttons.
 * @param fontChooser  used to decide which font to use in each color button's preview.
 * @param label        label for the row.
 * @param foregroundId identifier of the color to display in the foreground button.
 * @param backgroundId identifier of the color to display in the background button.
 * @param comp         component to register as a listener on the color buttons.
 */
protected PreviewLabel addColorButtons(ProportionalGridPanel gridPanel, FontChooser fontChooser, String label, int foregroundId, int backgroundId, JComponent comp) {
    ColorButton colorButton;
    PreviewLabel previewLabel;
    // Adds the row's caption label.
    gridPanel.add(createCaptionLabel(label));
    // Initialises the color buttons' preview label.
    previewLabel = new PreviewLabel();
    previewLabel.setTextPainted(true);
    addFontChooserListener(fontChooser, previewLabel);
    // Creates the foreground color button.
    gridPanel.add(colorButton = new ColorButton(parent, themeData, foregroundId, PreviewLabel.FOREGROUND_COLOR_PROPERTY_NAME, previewLabel));
    if (comp != null)
        colorButton.addUpdatedPreviewComponent(comp);
    // Creates the background color button.
    gridPanel.add(colorButton = new ColorButton(parent, themeData, backgroundId, PreviewLabel.BACKGROUND_COLOR_PROPERTY_NAME, previewLabel));
    if (comp != null)
        colorButton.addUpdatedPreviewComponent(comp);
    return previewLabel;
}
Also used : PreviewLabel(com.mucommander.ui.chooser.PreviewLabel)

Example 5 with PreviewLabel

use of com.mucommander.ui.chooser.PreviewLabel in project mucommander by mucommander.

the class FilePanel method addForegroundColor.

// - UI initialisation ---------------------------------------------------------------
// -----------------------------------------------------------------------------------
private void addForegroundColor(JPanel to, int colorId, ColorButton background, FontChooser fontChooser, FilePreviewPanel previewPanel) {
    PreviewLabel preview;
    ColorButton button;
    preview = new PreviewLabel();
    preview.setTextPainted(true);
    background.addUpdatedPreviewComponent(preview);
    addFontChooserListener(fontChooser, preview);
    to.add(button = new ColorButton(parent, themeData, colorId, PreviewLabel.FOREGROUND_COLOR_PROPERTY_NAME, preview));
    button.addUpdatedPreviewComponent(previewPanel);
}
Also used : PreviewLabel(com.mucommander.ui.chooser.PreviewLabel)

Aggregations

PreviewLabel (com.mucommander.ui.chooser.PreviewLabel)7 ProportionalGridPanel (com.mucommander.commons.util.ui.layout.ProportionalGridPanel)4 FontChooser (com.mucommander.ui.chooser.FontChooser)2 FlowLayout (java.awt.FlowLayout)2 JPanel (javax.swing.JPanel)2 YBoxPanel (com.mucommander.commons.util.ui.layout.YBoxPanel)1 JLabel (javax.swing.JLabel)1