use of com.mucommander.commons.util.ui.layout.ProportionalGridPanel in project mucommander by mucommander.
the class FileEditorPanel method createColorsPanel.
// - UI initialisation ---------------------------------------------------------------
// -----------------------------------------------------------------------------------
/**
* Creates the JPanel that contains all of the color configuration elements.
* @param fontChooser font chooser used by the editor panel.
* @return the JPanel that contains all of the color configuration elements.
*/
private JPanel createColorsPanel(FontChooser fontChooser) {
// Contains all the color buttons.
ProportionalGridPanel gridPanel;
// Used to wrap the colors panel in a flow layout.
JPanel colorsPanel;
// Initialisation.
gridPanel = new ProportionalGridPanel(3);
// Header.
addLabelRow(gridPanel, false);
// Color buttons.
addColorButtons(gridPanel, fontChooser, "theme_editor.normal", ThemeData.EDITOR_FOREGROUND_COLOR, ThemeData.EDITOR_BACKGROUND_COLOR).addPropertyChangeListener(this);
addColorButtons(gridPanel, fontChooser, "theme_editor.selected", ThemeData.EDITOR_SELECTED_FOREGROUND_COLOR, ThemeData.EDITOR_SELECTED_BACKGROUND_COLOR).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;
}
use of com.mucommander.commons.util.ui.layout.ProportionalGridPanel in project mucommander by mucommander.
the class FilePanel method initUI.
private void initUI(boolean isActive, FontChooser fontChooser) {
JPanel gridPanel;
ColorButton backgroundButton;
ColorButton selectedBackgroundButton;
ColorButton borderButton;
FilePreviewPanel preview;
gridPanel = new ProportionalGridPanel(3);
preview = new FilePreviewPanel(themeData, isActive);
addFontChooserListener(fontChooser, preview);
// Header
gridPanel.add(new JLabel());
gridPanel.add(createCaptionLabel("theme_editor.normal"));
gridPanel.add(createCaptionLabel("theme_editor.selected"));
// Background
gridPanel.add(createCaptionLabel("theme_editor.background"));
gridPanel.add(backgroundButton = new ColorButton(parent, themeData, isActive ? ThemeData.FILE_TABLE_BACKGROUND_COLOR : ThemeData.FILE_TABLE_INACTIVE_BACKGROUND_COLOR, PreviewLabel.BACKGROUND_COLOR_PROPERTY_NAME, preview));
gridPanel.add(selectedBackgroundButton = new ColorButton(parent, themeData, isActive ? ThemeData.FILE_TABLE_SELECTED_BACKGROUND_COLOR : ThemeData.FILE_TABLE_INACTIVE_SELECTED_BACKGROUND_COLOR, PreviewLabel.BACKGROUND_COLOR_PROPERTY_NAME, preview));
// Alternate background
gridPanel.add(createCaptionLabel("theme_editor.alternate_background"));
gridPanel.add(new ColorButton(parent, themeData, isActive ? ThemeData.FILE_TABLE_ALTERNATE_BACKGROUND_COLOR : ThemeData.FILE_TABLE_INACTIVE_ALTERNATE_BACKGROUND_COLOR, PreviewLabel.BACKGROUND_COLOR_PROPERTY_NAME, preview));
gridPanel.add(new JLabel());
// Folders.
gridPanel.add(createCaptionLabel("theme_editor.folder"));
addForegroundColor(gridPanel, isActive ? ThemeData.FOLDER_FOREGROUND_COLOR : ThemeData.FOLDER_INACTIVE_FOREGROUND_COLOR, backgroundButton, fontChooser, preview);
addForegroundColor(gridPanel, isActive ? ThemeData.FOLDER_SELECTED_FOREGROUND_COLOR : ThemeData.FOLDER_INACTIVE_SELECTED_FOREGROUND_COLOR, selectedBackgroundButton, fontChooser, preview);
// Plain files.
gridPanel.add(createCaptionLabel("theme_editor.plain_file"));
addForegroundColor(gridPanel, isActive ? ThemeData.FILE_FOREGROUND_COLOR : ThemeData.FILE_INACTIVE_FOREGROUND_COLOR, backgroundButton, fontChooser, preview);
addForegroundColor(gridPanel, isActive ? ThemeData.FILE_SELECTED_FOREGROUND_COLOR : ThemeData.FILE_INACTIVE_SELECTED_FOREGROUND_COLOR, selectedBackgroundButton, fontChooser, preview);
// Archives.
gridPanel.add(createCaptionLabel("theme_editor.archive_file"));
addForegroundColor(gridPanel, isActive ? ThemeData.ARCHIVE_FOREGROUND_COLOR : ThemeData.ARCHIVE_INACTIVE_FOREGROUND_COLOR, backgroundButton, fontChooser, preview);
addForegroundColor(gridPanel, isActive ? ThemeData.ARCHIVE_SELECTED_FOREGROUND_COLOR : ThemeData.ARCHIVE_INACTIVE_SELECTED_FOREGROUND_COLOR, selectedBackgroundButton, fontChooser, preview);
// Hidden files.
gridPanel.add(createCaptionLabel("theme_editor.hidden_file"));
addForegroundColor(gridPanel, isActive ? ThemeData.HIDDEN_FILE_FOREGROUND_COLOR : ThemeData.HIDDEN_FILE_INACTIVE_FOREGROUND_COLOR, backgroundButton, fontChooser, preview);
addForegroundColor(gridPanel, isActive ? ThemeData.HIDDEN_FILE_SELECTED_FOREGROUND_COLOR : ThemeData.HIDDEN_FILE_INACTIVE_SELECTED_FOREGROUND_COLOR, selectedBackgroundButton, fontChooser, preview);
// Symlinks.
gridPanel.add(createCaptionLabel("theme_editor.symbolic_link"));
addForegroundColor(gridPanel, isActive ? ThemeData.SYMLINK_FOREGROUND_COLOR : ThemeData.SYMLINK_INACTIVE_FOREGROUND_COLOR, backgroundButton, fontChooser, preview);
addForegroundColor(gridPanel, isActive ? ThemeData.SYMLINK_SELECTED_FOREGROUND_COLOR : ThemeData.SYMLINK_INACTIVE_SELECTED_FOREGROUND_COLOR, selectedBackgroundButton, fontChooser, preview);
// Marked files.
gridPanel.add(createCaptionLabel("theme_editor.marked_file"));
addForegroundColor(gridPanel, isActive ? ThemeData.MARKED_FOREGROUND_COLOR : ThemeData.MARKED_INACTIVE_FOREGROUND_COLOR, backgroundButton, fontChooser, preview);
addForegroundColor(gridPanel, isActive ? ThemeData.MARKED_SELECTED_FOREGROUND_COLOR : ThemeData.MARKED_INACTIVE_SELECTED_FOREGROUND_COLOR, selectedBackgroundButton, fontChooser, preview);
// Border.
gridPanel.add(createCaptionLabel("theme_editor.border"));
gridPanel.add(borderButton = new ColorButton(parent, themeData, isActive ? ThemeData.FILE_TABLE_BORDER_COLOR : ThemeData.FILE_TABLE_INACTIVE_BORDER_COLOR, PreviewLabel.BORDER_COLOR_PROPERTY_NAME));
borderButton.addUpdatedPreviewComponent(preview);
gridPanel.add(borderButton = new ColorButton(parent, themeData, isActive ? ThemeData.FILE_TABLE_SELECTED_OUTLINE_COLOR : ThemeData.FILE_TABLE_INACTIVE_SELECTED_OUTLINE_COLOR, PreviewLabel.BORDER_COLOR_PROPERTY_NAME));
borderButton.addUpdatedPreviewComponent(preview);
setLayout(new BorderLayout());
add(gridPanel, BorderLayout.WEST);
add(preview, BorderLayout.EAST);
}
use of com.mucommander.commons.util.ui.layout.ProportionalGridPanel in project mucommander by mucommander.
the class AppearancePanel method createIconSizePanel.
/**
* Creates the icon size panel.
*
* @return the icon size panel.
*/
private JPanel createIconSizePanel() {
ProportionalGridPanel gridPanel = new ProportionalGridPanel(2);
gridPanel.add(new JLabel(Translator.get("prefs_dialog.toolbar_icons")));
gridPanel.add(toolbarIconsSizeComboBox = createIconSizeCombo(MuPreference.TOOLBAR_ICON_SCALE, MuPreferences.DEFAULT_TOOLBAR_ICON_SCALE));
gridPanel.add(new JLabel(Translator.get("prefs_dialog.command_bar_icons")));
gridPanel.add(commandBarIconsSizeComboBox = createIconSizeCombo(MuPreference.COMMAND_BAR_ICON_SCALE, MuPreferences.DEFAULT_COMMAND_BAR_ICON_SCALE));
gridPanel.add(new JLabel(Translator.get("prefs_dialog.file_icons")));
gridPanel.add(fileIconsSizeComboBox = createIconSizeCombo(MuPreference.TABLE_ICON_SCALE, MuPreferences.DEFAULT_TABLE_ICON_SCALE));
JPanel flowPanel = new JPanel(new FlowLayout(FlowLayout.LEADING));
flowPanel.setBorder(BorderFactory.createTitledBorder(Translator.get("prefs_dialog.icons_size")));
flowPanel.add(gridPanel);
return flowPanel;
}
use of com.mucommander.commons.util.ui.layout.ProportionalGridPanel in project mucommander by mucommander.
the class AppearancePanel method createThemesPanel.
/**
* Creates the themes panel.
*
* @return the themes panel.
*/
private JPanel createThemesPanel() {
JPanel gridPanel = new ProportionalGridPanel(4);
// Creates the various panel's buttons.
editThemeButton = new JButton(Translator.get("edit") + "...");
importThemeButton = new JButton(Translator.get("prefs_dialog.import") + "...");
exportThemeButton = new JButton(Translator.get("prefs_dialog.export") + "...");
renameThemeButton = new JButton(Translator.get("rename"));
deleteThemeButton = new JButton(Translator.get("delete"));
duplicateThemeButton = new JButton(Translator.get("duplicate"));
editThemeButton.addActionListener(this);
importThemeButton.addActionListener(this);
exportThemeButton.addActionListener(this);
renameThemeButton.addActionListener(this);
deleteThemeButton.addActionListener(this);
duplicateThemeButton.addActionListener(this);
// Creates the panel's 'type label'.
typeLabel = new JLabel("");
// Creates the theme combo box.
themeComboBox = new PrefComboBox() {
public boolean hasChanged() {
return !ThemeManager.isCurrentTheme((Theme) getSelectedItem());
}
};
themeComboBox.addActionListener(this);
// Sets the combobox's renderer.
lockIcon = IconManager.getIcon(IconManager.PREFERENCES_ICON_SET, "lock.png");
transparentIcon = new ImageIcon(new BufferedImage(lockIcon.getIconWidth(), lockIcon.getIconHeight(), BufferedImage.TYPE_INT_ARGB));
themeComboBox.setRenderer(new BasicComboBoxRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel label;
Theme theme;
label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
theme = (Theme) value;
if (ThemeManager.isCurrentTheme(theme))
label.setText(theme.getName() + " (" + Translator.get("theme.current") + ")");
else
label.setText(theme.getName());
if (theme.getType() != Theme.CUSTOM_THEME)
label.setIcon(lockIcon);
else
label.setIcon(transparentIcon);
return label;
}
});
// Initialises the content of the combo box.
populateThemes(ThemeManager.getCurrentTheme());
gridPanel.add(themeComboBox);
gridPanel.add(editThemeButton);
gridPanel.add(importThemeButton);
gridPanel.add(exportThemeButton);
gridPanel.add(typeLabel);
gridPanel.add(renameThemeButton);
gridPanel.add(deleteThemeButton);
gridPanel.add(duplicateThemeButton);
JPanel flowPanel = new JPanel(new FlowLayout(FlowLayout.LEADING));
flowPanel.setBorder(BorderFactory.createTitledBorder(Translator.get("prefs_dialog.themes")));
flowPanel.add(gridPanel);
return flowPanel;
}
use of com.mucommander.commons.util.ui.layout.ProportionalGridPanel 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;
}
Aggregations