Search in sources :

Example 1 with FontChooser

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

the class ShellPanel method createConfigurationPanel.

private JComponent createConfigurationPanel(int fontId, int foregroundId, int backgroundId, int selectedForegroundId, int selectedBackgroundId, JComponent fontListener) {
    YBoxPanel mainPanel;
    ProportionalGridPanel colorPanel;
    JPanel flowPanel;
    FontChooser fontChooser;
    mainPanel = new YBoxPanel();
    fontChooser = createFontChooser(fontId);
    mainPanel.add(fontChooser);
    mainPanel.addSpace(10);
    addFontChooserListener(fontChooser, fontListener);
    colorPanel = new ProportionalGridPanel(3);
    addLabelRow(colorPanel, false);
    addColorButtons(colorPanel, fontChooser, "theme_editor.normal", foregroundId, backgroundId).addPropertyChangeListener(this);
    addColorButtons(colorPanel, fontChooser, "theme_editor.selected", selectedForegroundId, selectedBackgroundId).addPropertyChangeListener(this);
    flowPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    flowPanel.add(colorPanel);
    flowPanel.setBorder(BorderFactory.createTitledBorder(Translator.get("theme_editor.colors")));
    mainPanel.add(flowPanel);
    return createScrollPane(mainPanel);
}
Also used : YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel) FontChooser(com.mucommander.ui.chooser.FontChooser) ProportionalGridPanel(com.mucommander.commons.util.ui.layout.ProportionalGridPanel)

Example 2 with FontChooser

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

the class ThemeEditorPanel method createFontChooser.

// - Font chooser code ---------------------------------------------------------------
// -----------------------------------------------------------------------------------
/**
 * Creates a font chooser that will keep the specified font up-to-date in the current theme data.
 * @param fontId identifier of the font this chooser will be editing.
 */
protected FontChooser createFontChooser(int fontId) {
    // Font chooser that will be returned.
    FontChooser fontChooser;
    // Internal listener.
    ChangeListener listener;
    // Initialises the font chooser.
    fontChooser = new FontChooser(themeData.getFont(fontId));
    fontChooser.setBorder(BorderFactory.createTitledBorder(Translator.get("theme_editor.font")));
    fontChooser.addChangeListener(listener = new ThemeFontChooserListener(themeData, fontId, parent));
    // Hold a reference to this listener to prevent garbage collection
    listenerReferences.add(listener);
    return fontChooser;
}
Also used : FontChooser(com.mucommander.ui.chooser.FontChooser) ChangeListener(javax.swing.event.ChangeListener)

Example 3 with FontChooser

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

the class LocationBarPanel method createConfigurationPanel.

private JPanel createConfigurationPanel() {
    FontChooser fontChooser = createFontChooser(ThemeData.LOCATION_BAR_FONT);
    addFontChooserListener(fontChooser, normalPreview);
    addFontChooserListener(fontChooser, progressPreview);
    ProportionalGridPanel colorsPanel = new ProportionalGridPanel(3);
    addLabelRow(colorsPanel, false);
    PreviewLabel label = new PreviewLabel();
    addColorButtons(colorsPanel, fontChooser, "theme_editor.normal", ThemeData.LOCATION_BAR_FOREGROUND_COLOR, ThemeData.LOCATION_BAR_BACKGROUND_COLOR, label).addPropertyChangeListener(this);
    addColorButtons(colorsPanel, fontChooser, "theme_editor.selected", ThemeData.LOCATION_BAR_SELECTED_FOREGROUND_COLOR, ThemeData.LOCATION_BAR_SELECTED_BACKGROUND_COLOR).addPropertyChangeListener(this);
    label.setTextPainted(true);
    addFontChooserListener(fontChooser, label);
    colorsPanel.add(createCaptionLabel("theme_editor.progress"));
    colorsPanel.add(new JLabel());
    colorsPanel.add(new ColorButton(parent, themeData, ThemeData.LOCATION_BAR_PROGRESS_COLOR, PreviewLabel.OVERLAY_COLOR_PROPERTY_NAME, label));
    label.addPropertyChangeListener(this);
    JPanel flowPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    flowPanel.add(colorsPanel);
    flowPanel.setBorder(BorderFactory.createTitledBorder(Translator.get("theme_editor.colors")));
    YBoxPanel mainPanel = new YBoxPanel();
    mainPanel.add(fontChooser);
    mainPanel.addSpace(10);
    mainPanel.add(flowPanel);
    return mainPanel;
}
Also used : PreviewLabel(com.mucommander.ui.chooser.PreviewLabel) YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel) FontChooser(com.mucommander.ui.chooser.FontChooser) ProportionalGridPanel(com.mucommander.commons.util.ui.layout.ProportionalGridPanel)

Example 4 with FontChooser

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

the class QuickListPanel method initUI.

/**
 * Initializes the panel's UI.
 */
private void initUI() {
    // Contains all the configuration elements.
    YBoxPanel headerConfigurationPanel;
    // Contains all the configuration elements.
    YBoxPanel itemConfigurationPanel;
    // Used to select a font.
    FontChooser fontChooser1;
    // Used to select a font.
    FontChooser fontChooser2;
    // Main panel.
    JPanel mainPanel;
    JTabbedPane tabbedPane;
    header.addComponentListener(new ComponentListener() {

        public void componentHidden(ComponentEvent e) {
        }

        public void componentMoved(ComponentEvent e) {
        }

        public void componentResized(ComponentEvent e) {
            quickListPreviewPanel.repaint();
        }

        public void componentShown(ComponentEvent e) {
        }
    });
    // Font chooser and preview initialization.
    fontChooser1 = createFontChooser(ThemeData.QUICK_LIST_HEADER_FONT);
    fontChooser2 = createFontChooser(ThemeData.QUICK_LIST_ITEM_FONT);
    addFontChooserListener(fontChooser1, header);
    addFontChooserListener(fontChooser2, list);
    // Header configuration panel initialization.
    headerConfigurationPanel = new YBoxPanel();
    headerConfigurationPanel.add(fontChooser1);
    headerConfigurationPanel.addSpace(10);
    headerConfigurationPanel.add(createHeaderColorsPanel(fontChooser1));
    // Item configuration panel initialization.
    itemConfigurationPanel = new YBoxPanel();
    itemConfigurationPanel.add(fontChooser2);
    itemConfigurationPanel.addSpace(10);
    itemConfigurationPanel.add(createItemColorsPanel(fontChooser1));
    // Create the tabbed pane.
    tabbedPane = new JTabbedPane();
    tabbedPane.add(Translator.get("theme_editor.header"), headerConfigurationPanel);
    tabbedPane.add(Translator.get("theme_editor.item"), itemConfigurationPanel);
    // Main layout.
    mainPanel = new JPanel(new BorderLayout());
    mainPanel.add(tabbedPane, BorderLayout.CENTER);
    mainPanel.add(createPreviewPanel(), BorderLayout.EAST);
    // Layout.
    setLayout(new BorderLayout());
    add(mainPanel, BorderLayout.NORTH);
}
Also used : JPanel(javax.swing.JPanel) ComponentListener(java.awt.event.ComponentListener) YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel) BorderLayout(java.awt.BorderLayout) FontChooser(com.mucommander.ui.chooser.FontChooser) JTabbedPane(javax.swing.JTabbedPane) ComponentEvent(java.awt.event.ComponentEvent)

Example 5 with FontChooser

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

the class StatusBarPanel method initUI.

/**
 * Initialises the panel's UI.
 */
private void initUI() {
    PreviewLabel previewLabel;
    PreviewLabel borderPreviewLabel;
    FontChooser fontChooser = createFontChooser(ThemeData.STATUS_BAR_FONT);
    // Initialises the foreground color button.
    ColorButton foreground = new ColorButton(parent, themeData, ThemeData.STATUS_BAR_FOREGROUND_COLOR, PreviewLabel.FOREGROUND_COLOR_PROPERTY_NAME, previewLabel = new PreviewLabel());
    previewLabel.setTextPainted(true);
    addFontChooserListener(fontChooser, previewLabel);
    previewLabel.addPropertyChangeListener(this);
    // Initialises the background and border color buttons.
    ColorButton background = new ColorButton(parent, themeData, ThemeData.STATUS_BAR_BACKGROUND_COLOR, PreviewLabel.BACKGROUND_COLOR_PROPERTY_NAME, previewLabel = new PreviewLabel());
    ColorButton border = new ColorButton(parent, themeData, ThemeData.STATUS_BAR_BORDER_COLOR, PreviewLabel.BORDER_COLOR_PROPERTY_NAME, borderPreviewLabel = new PreviewLabel());
    // Initialises the background color preview.
    previewLabel.setTextPainted(true);
    foreground.addUpdatedPreviewComponent(previewLabel);
    border.addUpdatedPreviewComponent(previewLabel);
    addFontChooserListener(fontChooser, previewLabel);
    previewLabel.addPropertyChangeListener(this);
    // Initialises the border color preview.
    borderPreviewLabel.setTextPainted(true);
    foreground.addUpdatedPreviewComponent(borderPreviewLabel);
    background.addUpdatedPreviewComponent(borderPreviewLabel);
    addFontChooserListener(fontChooser, borderPreviewLabel);
    borderPreviewLabel.addPropertyChangeListener(this);
    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.add(Translator.get("theme_editor.general"), createGeneralPanel(fontChooser, foreground));
    tabbedPane.add(Translator.get("theme_editor.free_space"), createFreeSpacePanel(fontChooser, foreground, background, border));
    // Main layout.
    JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.add(tabbedPane, BorderLayout.CENTER);
    mainPanel.add(createPreviewPanel(fontChooser), BorderLayout.EAST);
    // Aligns everything north.
    setLayout(new BorderLayout());
    add(mainPanel, BorderLayout.NORTH);
}
Also used : PreviewLabel(com.mucommander.ui.chooser.PreviewLabel) FontChooser(com.mucommander.ui.chooser.FontChooser)

Aggregations

FontChooser (com.mucommander.ui.chooser.FontChooser)7 YBoxPanel (com.mucommander.commons.util.ui.layout.YBoxPanel)4 ProportionalGridPanel (com.mucommander.commons.util.ui.layout.ProportionalGridPanel)2 PreviewLabel (com.mucommander.ui.chooser.PreviewLabel)2 BorderLayout (java.awt.BorderLayout)1 ComponentEvent (java.awt.event.ComponentEvent)1 ComponentListener (java.awt.event.ComponentListener)1 JPanel (javax.swing.JPanel)1 JTabbedPane (javax.swing.JTabbedPane)1 ChangeListener (javax.swing.event.ChangeListener)1