mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Fix so scrollbars and buttons aren't messed up when skin changed
This commit is contained in:
@@ -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,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;
|
||||
}
|
||||
@@ -1966,14 +1971,13 @@ public enum FSkin {
|
||||
}
|
||||
|
||||
private ArrayList<Object> getColorGradients(Color bottom, Color top) {
|
||||
ArrayList<Object> gradients = new ArrayList<>();
|
||||
gradients.add(0.0);
|
||||
gradients.add(0.0);
|
||||
gradients.add(top);
|
||||
gradients.add(bottom);
|
||||
gradients.add(bottom);
|
||||
return gradients;
|
||||
ArrayList<Object> gradients = new ArrayList<>();
|
||||
gradients.add(0.0);
|
||||
gradients.add(0.0);
|
||||
gradients.add(top);
|
||||
gradients.add(bottom);
|
||||
gradients.add(bottom);
|
||||
return gradients;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user