- ComboBox style now set globally via UIManager which should hopefully resolve issue with Mac (see http://www.slightlymagic.net/forum/viewtopic.php?f=52&t=11126#p125845).

This commit is contained in:
spr
2013-08-16 19:45:42 +00:00
parent ce988a66df
commit ef8bb689d7
2 changed files with 466 additions and 451 deletions

View File

@@ -172,6 +172,7 @@ public enum FControl {
UIManager.put("TabbedPane.selected", FSkin.getColor(FSkin.Colors.CLR_ACTIVE)); UIManager.put("TabbedPane.selected", FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
UIManager.put("TabbedPane.contentOpaque", FSkin.getColor(FSkin.Colors.CLR_THEME)); UIManager.put("TabbedPane.contentOpaque", FSkin.getColor(FSkin.Colors.CLR_THEME));
UIManager.put("TabbedPane.unselectedBackground", FSkin.getColor(FSkin.Colors.CLR_THEME2)); UIManager.put("TabbedPane.unselectedBackground", FSkin.getColor(FSkin.Colors.CLR_THEME2));
setComboBoxLookAndFeel();
this.shortcuts = KeyboardShortcuts.attachKeyboardShortcuts(); this.shortcuts = KeyboardShortcuts.attachKeyboardShortcuts();
this.display = FView.SINGLETON_INSTANCE.getLpnDocument(); this.display = FView.SINGLETON_INSTANCE.getLpnDocument();
@@ -207,6 +208,22 @@ public enum FControl {
public void run() { Singletons.getView().initialize(); } }); public void run() { Singletons.getView().initialize(); } });
} }
/**
* @see <a href="http://tips4java.wordpress.com/2008/10/09/uimanager-defaults/">UIManager Defaults</a>
*/
private void setComboBoxLookAndFeel() {
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_THEMED_COMBOBOX)) {
UIManager.put("ComboBox.background", FSkin.getColor(FSkin.Colors.CLR_THEME2));
UIManager.put("ComboBox.foreground", FSkin.getColor(FSkin.Colors.CLR_TEXT));
UIManager.put("ComboBox.selectionBackground", FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
UIManager.put("ComboBox.selectionForeground", FSkin.getColor(FSkin.Colors.CLR_TEXT));
UIManager.put("ComboBox.disabledBackground", FSkin.getColor(FSkin.Colors.CLR_THEME2));
UIManager.put("ComboBox.disabledForeground", FSkin.getColor(FSkin.Colors.CLR_THEME2).darker());
UIManager.put("Button.select", FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
UIManager.put("ComboBox.font", FSkin.getFont(UIManager.getFont("ComboBox.font").getSize()));
}
}
/** /**
* Switches between display states in top level JFrame. * Switches between display states in top level JFrame.
*/ */

View File

@@ -96,8 +96,6 @@ public class FComboBoxPanel<E> extends JPanel {
lst0, val0, i0, isSelected, cellHasFocus); lst0, val0, i0, isSelected, cellHasFocus);
lblItem.setBorder(new EmptyBorder(4, 3, 4, 3)); lblItem.setBorder(new EmptyBorder(4, 3, 4, 3));
lblItem.setBackground(FSkin.getColor(hasFocus() ? FSkin.Colors.CLR_ACTIVE : FSkin.Colors.CLR_INACTIVE));
lblItem.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
lblItem.setFont(FSkin.getFont(12)); lblItem.setFont(FSkin.getFont(12));
lblItem.setOpaque(isSelected); lblItem.setOpaque(isSelected);
return lblItem; return lblItem;