summaryrefslogtreecommitdiff
path: root/enigma-swing/src/main/java
diff options
context:
space:
mode:
authorGravatar Juuxel2021-03-15 13:36:34 +0200
committerGravatar Juuxel2021-03-15 13:36:34 +0200
commita4246b6166b45ac79c87c42d2a56bc7f95205a62 (patch)
tree8f531922742ac6fa59ee0b4c1a49bf1c66383df0 /enigma-swing/src/main/java
parentBump version (diff)
downloadenigma-a4246b6166b45ac79c87c42d2a56bc7f95205a62.tar.gz
enigma-a4246b6166b45ac79c87c42d2a56bc7f95205a62.tar.xz
enigma-a4246b6166b45ac79c87c42d2a56bc7f95205a62.zip
Migrate to FlatLaf
Fixes #355. - Replaces the Darcula look and feel with FlatLaf Darcula, which does not have the same rendering bugs with CJK characters (at least on Windows 10). - Replaces Metal with FlatLaf Light as the default look and feel. Metal is provided as a new, separate theme option.
Diffstat (limited to 'enigma-swing/src/main/java')
-rw-r--r--enigma-swing/src/main/java/cuchaz/enigma/gui/config/LookAndFeel.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/config/LookAndFeel.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/config/LookAndFeel.java
index 1c70d439..d1d3e0df 100644
--- a/enigma-swing/src/main/java/cuchaz/enigma/gui/config/LookAndFeel.java
+++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/config/LookAndFeel.java
@@ -8,16 +8,18 @@ import javax.swing.JPanel;
8import javax.swing.UIManager; 8import javax.swing.UIManager;
9import javax.swing.plaf.metal.MetalLookAndFeel; 9import javax.swing.plaf.metal.MetalLookAndFeel;
10 10
11import com.bulenkov.darcula.DarculaLaf; 11import com.formdev.flatlaf.FlatDarculaLaf;
12import com.formdev.flatlaf.FlatLightLaf;
12 13
13public enum LookAndFeel { 14public enum LookAndFeel {
14 DEFAULT("Default"), 15 DEFAULT("Default"),
15 DARCULA("Darcula"), 16 DARCULA("Darcula"),
17 METAL("Metal"),
16 SYSTEM("System"), 18 SYSTEM("System"),
17 NONE("None (JVM default)"); 19 NONE("None (JVM default)");
18 20
19 // the "JVM default" look and feel, get it at the beginning and store it so we can set it later 21 // the "JVM default" look and feel, get it at the beginning and store it so we can set it later
20 private static javax.swing.LookAndFeel NONE_LAF = UIManager.getLookAndFeel(); 22 private static final javax.swing.LookAndFeel NONE_LAF = UIManager.getLookAndFeel();
21 private final String name; 23 private final String name;
22 24
23 LookAndFeel(String name) { 25 LookAndFeel(String name) {
@@ -35,10 +37,13 @@ public enum LookAndFeel {
35 UIManager.setLookAndFeel(NONE_LAF); 37 UIManager.setLookAndFeel(NONE_LAF);
36 break; 38 break;
37 case DEFAULT: 39 case DEFAULT:
40 UIManager.setLookAndFeel(new FlatLightLaf());
41 break;
42 case METAL:
38 UIManager.setLookAndFeel(new MetalLookAndFeel()); 43 UIManager.setLookAndFeel(new MetalLookAndFeel());
39 break; 44 break;
40 case DARCULA: 45 case DARCULA:
41 UIManager.setLookAndFeel(new DarculaLaf()); 46 UIManager.setLookAndFeel(new FlatDarculaLaf());
42 break; 47 break;
43 case SYSTEM: 48 case SYSTEM:
44 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 49 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());