mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38: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 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 static boolean onInit = true;
|
||||||
private Color BACK_COLOR = FSkin.getColor(FSkin.Colors.CLR_THEME2).color;
|
private static boolean isMetalLafSet = false;
|
||||||
private Color HIGHLIGHT_COLOR = BACK_COLOR.brighter();
|
|
||||||
private Border LINE_BORDER = BorderFactory.createLineBorder(FORE_COLOR.darker(), 1);
|
private final Color FORE_COLOR = FSkin.getColor(FSkin.Colors.CLR_TEXT).color;
|
||||||
private Border EMPTY_BORDER = BorderFactory.createEmptyBorder(2,2,2,2);
|
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.
|
* 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 (isUIManagerEnabled()) {
|
||||||
if (setMetalLookAndFeel(appFrame)) {
|
if (setMetalLookAndFeel(appFrame)) {
|
||||||
setMenusLookAndFeel();
|
setMenusLookAndFeel();
|
||||||
@@ -1852,6 +1855,7 @@ public enum FSkin {
|
|||||||
setButtonLookAndFeel();
|
setButtonLookAndFeel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onInit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1861,14 +1865,15 @@ public enum FSkin {
|
|||||||
* not support various settings (eg. combobox background color).
|
* not support various settings (eg. combobox background color).
|
||||||
*/
|
*/
|
||||||
private boolean setMetalLookAndFeel(JFrame appFrame) {
|
private boolean setMetalLookAndFeel(JFrame appFrame) {
|
||||||
boolean isMetalLafSet = false;
|
if (onInit) { //only attempt to set Metal Look and Feel the first time
|
||||||
try {
|
try {
|
||||||
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
|
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
|
||||||
SwingUtilities.updateComponentTreeUI(appFrame);
|
SwingUtilities.updateComponentTreeUI(appFrame);
|
||||||
isMetalLafSet = true;
|
isMetalLafSet = true;
|
||||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
|
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
|
||||||
// Auto-generated catch block ignores the exception, but sends it to System.err and probably forge.log.
|
// Auto-generated catch block ignores the exception, but sends it to System.err and probably forge.log.
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return isMetalLafSet;
|
return isMetalLafSet;
|
||||||
}
|
}
|
||||||
@@ -1966,14 +1971,13 @@ public enum FSkin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ArrayList<Object> getColorGradients(Color bottom, Color top) {
|
private ArrayList<Object> getColorGradients(Color bottom, Color top) {
|
||||||
ArrayList<Object> gradients = new ArrayList<>();
|
ArrayList<Object> gradients = new ArrayList<>();
|
||||||
gradients.add(0.0);
|
gradients.add(0.0);
|
||||||
gradients.add(0.0);
|
gradients.add(0.0);
|
||||||
gradients.add(top);
|
gradients.add(top);
|
||||||
gradients.add(bottom);
|
gradients.add(bottom);
|
||||||
gradients.add(bottom);
|
gradients.add(bottom);
|
||||||
return gradients;
|
return gradients;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user