Fix so scrollbars and buttons aren't messed up when skin changed

This commit is contained in:
drdev
2013-09-03 22:47:28 +00:00
parent cfed3ee53a
commit b9d5cc4ae7

View File

@@ -1834,16 +1834,19 @@ public enum FSkin {
*/
private static class ForgeLookAndFeel { //needs to live in FSkin for access to skin colors
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 static boolean onInit = true;
private static boolean isMetalLafSet = false;
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,7 +1865,7 @@ public enum FSkin {
* not support various settings (eg. combobox background color).
*/
private boolean setMetalLookAndFeel(JFrame appFrame) {
boolean isMetalLafSet = false;
if (onInit) { //only attempt to set Metal Look and Feel the first time
try {
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
SwingUtilities.updateComponentTreeUI(appFrame);
@@ -1870,6 +1874,7 @@ public enum FSkin {
// Auto-generated catch block ignores the exception, but sends it to System.err and probably forge.log.
e.printStackTrace();
}
}
return isMetalLafSet;
}
@@ -1974,6 +1979,5 @@ public enum FSkin {
gradients.add(bottom);
return gradients;
}
}
}