diff --git a/src/main/java/forge/gui/toolbox/FSkin.java b/src/main/java/forge/gui/toolbox/FSkin.java
index 1acd89c3d97..bd209f57fd4 100644
--- a/src/main/java/forge/gui/toolbox/FSkin.java
+++ b/src/main/java/forge/gui/toolbox/FSkin.java
@@ -1833,17 +1833,20 @@ public enum FSkin {
* @see UIManager Defaults
*/
private static class ForgeLookAndFeel { //needs to live in FSkin for access to skin colors
+
+ private static boolean onInit = true;
+ private static boolean isMetalLafSet = false;
- private Color FORE_COLOR = FSkin.getColor(FSkin.Colors.CLR_TEXT).color;
- private Color BACK_COLOR = FSkin.getColor(FSkin.Colors.CLR_THEME2).color;
- private Color HIGHLIGHT_COLOR = BACK_COLOR.brighter();
- private Border LINE_BORDER = BorderFactory.createLineBorder(FORE_COLOR.darker(), 1);
- private Border EMPTY_BORDER = BorderFactory.createEmptyBorder(2,2,2,2);
+ private final Color FORE_COLOR = FSkin.getColor(FSkin.Colors.CLR_TEXT).color;
+ private final Color BACK_COLOR = FSkin.getColor(FSkin.Colors.CLR_THEME2).color;
+ private final Color HIGHLIGHT_COLOR = BACK_COLOR.brighter();
+ private final Border LINE_BORDER = BorderFactory.createLineBorder(FORE_COLOR.darker(), 1);
+ private final Border EMPTY_BORDER = BorderFactory.createEmptyBorder(2, 2, 2, 2);
/**
* Sets the look and feel of the GUI based on the selected Forge theme.
*/
- public void setForgeLookAndFeel(JFrame appFrame) {
+ private void setForgeLookAndFeel(final JFrame appFrame) {
if (isUIManagerEnabled()) {
if (setMetalLookAndFeel(appFrame)) {
setMenusLookAndFeel();
@@ -1852,6 +1855,7 @@ public enum FSkin {
setButtonLookAndFeel();
}
}
+ onInit = false;
}
/**
@@ -1861,14 +1865,15 @@ public enum FSkin {
* not support various settings (eg. combobox background color).
*/
private boolean setMetalLookAndFeel(JFrame appFrame) {
- boolean isMetalLafSet = false;
- try {
- UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
- SwingUtilities.updateComponentTreeUI(appFrame);
- isMetalLafSet = true;
- } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
- // Auto-generated catch block ignores the exception, but sends it to System.err and probably forge.log.
- e.printStackTrace();
+ if (onInit) { //only attempt to set Metal Look and Feel the first time
+ try {
+ UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
+ SwingUtilities.updateComponentTreeUI(appFrame);
+ isMetalLafSet = true;
+ } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
+ // Auto-generated catch block ignores the exception, but sends it to System.err and probably forge.log.
+ e.printStackTrace();
+ }
}
return isMetalLafSet;
}
@@ -1883,30 +1888,30 @@ public enum FSkin {
Color menuBarEdgeColor = FSkin.stepColor(clrTheme, -80);
UIManager.put("MenuBar.foreground", FORE_COLOR);
UIManager.put("MenuBar.gradient", getColorGradients(backgroundColor.darker(), backgroundColor));
- UIManager.put("MenuBar.border", BorderFactory.createMatteBorder(0, 0, 1, 0, menuBarEdgeColor));
+ UIManager.put("MenuBar.border", BorderFactory.createMatteBorder(0, 0, 1, 0, menuBarEdgeColor));
// JMenu
UIManager.put("Menu.foreground", FORE_COLOR);
UIManager.put("Menu.background", BACK_COLOR);
- UIManager.put("Menu.borderPainted", false);
+ UIManager.put("Menu.borderPainted", false);
UIManager.put("Menu.selectionBackground", HIGHLIGHT_COLOR);
UIManager.put("Menu.selectionForeground", FORE_COLOR);
- UIManager.put("Menu.border", EMPTY_BORDER);
+ UIManager.put("Menu.border", EMPTY_BORDER);
UIManager.put("Menu.opaque", false);
// JPopupMenu
UIManager.put("PopupMenu.border", LINE_BORDER);
UIManager.put("PopupMenu.background", BACK_COLOR);
- UIManager.put("PopupMenu.foreground", FORE_COLOR);
+ UIManager.put("PopupMenu.foreground", FORE_COLOR);
// JMenuItem
UIManager.put("MenuItem.foreground", FORE_COLOR);
UIManager.put("MenuItem.background", BACK_COLOR);
- UIManager.put("MenuItem.border", EMPTY_BORDER);
+ UIManager.put("MenuItem.border", EMPTY_BORDER);
UIManager.put("MenuItem.selectionBackground", HIGHLIGHT_COLOR);
UIManager.put("MenuItem.selectionForeground", FORE_COLOR);
UIManager.put("MenuItem.acceleratorForeground", FORE_COLOR.darker());
UIManager.put("MenuItem.opaque", true);
// JSeparator (needs to be opaque!).
UIManager.put("Separator.foreground", FORE_COLOR.darker());
- UIManager.put("Separator.background", BACK_COLOR);
+ UIManager.put("Separator.background", BACK_COLOR);
// JRadioButtonMenuItem
UIManager.put("RadioButtonMenuItem.foreground", FORE_COLOR);
UIManager.put("RadioButtonMenuItem.background", BACK_COLOR);
@@ -1920,13 +1925,13 @@ public enum FSkin {
UIManager.put("CheckBoxMenuItem.selectionBackground", HIGHLIGHT_COLOR);
UIManager.put("CheckBoxMenuItem.selectionForeground", FORE_COLOR);
UIManager.put("CheckBoxMenuItem.border", EMPTY_BORDER);
- UIManager.put("CheckBoxMenuItem.acceleratorForeground", FORE_COLOR.darker());
- }
+ UIManager.put("CheckBoxMenuItem.acceleratorForeground", FORE_COLOR.darker());
+ }
private void setTabbedPaneLookAndFeel() {
UIManager.put("TabbedPane.selected", HIGHLIGHT_COLOR);
UIManager.put("TabbedPane.contentOpaque", FSkin.getColor(FSkin.Colors.CLR_THEME));
- UIManager.put("TabbedPane.unselectedBackground", BACK_COLOR);
+ UIManager.put("TabbedPane.unselectedBackground", BACK_COLOR);
}
/**
@@ -1938,18 +1943,18 @@ public enum FSkin {
UIManager.put("ComboBox.selectionBackground", HIGHLIGHT_COLOR);
UIManager.put("ComboBox.selectionForeground", FORE_COLOR);
UIManager.put("ComboBox.disabledBackground", BACK_COLOR);
- UIManager.put("ComboBox.disabledForeground", BACK_COLOR.darker());
+ UIManager.put("ComboBox.disabledForeground", BACK_COLOR.darker());
UIManager.put("ComboBox.font", getDefaultFont("ComboBox.font"));
UIManager.put("Button.select", HIGHLIGHT_COLOR);
}
private void setButtonLookAndFeel() {
UIManager.put("Button.foreground", FORE_COLOR);
- UIManager.put("Button.background", BACK_COLOR);
+ UIManager.put("Button.background", BACK_COLOR);
UIManager.put("Button.select", HIGHLIGHT_COLOR);
UIManager.put("Button.focus", FORE_COLOR.darker());
UIManager.put("Button.rollover", false);
- }
+ }
/**
* Determines whether theme styles should be applied to GUI.
@@ -1966,14 +1971,13 @@ public enum FSkin {
}
private ArrayList