From a4246b6166b45ac79c87c42d2a56bc7f95205a62 Mon Sep 17 00:00:00 2001 From: Juuxel Date: Mon, 15 Mar 2021 13:36:34 +0200 Subject: 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. --- enigma-swing/build.gradle | 2 +- .../src/main/java/cuchaz/enigma/gui/config/LookAndFeel.java | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'enigma-swing') diff --git a/enigma-swing/build.gradle b/enigma-swing/build.gradle index 2966ae72..e0f6f66e 100644 --- a/enigma-swing/build.gradle +++ b/enigma-swing/build.gradle @@ -8,7 +8,7 @@ dependencies { implementation project(':enigma-server') implementation 'net.sf.jopt-simple:jopt-simple:6.0-alpha-3' - implementation 'com.bulenkov:darcula:1.0.0-bobbylight' + implementation 'com.formdev:flatlaf:1.0' implementation 'de.sciss:syntaxpane:1.2.0' implementation 'com.github.lukeu:swing-dpi:0.6' implementation 'org.drjekyll:fontchooser:2.4' 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; import javax.swing.UIManager; import javax.swing.plaf.metal.MetalLookAndFeel; -import com.bulenkov.darcula.DarculaLaf; +import com.formdev.flatlaf.FlatDarculaLaf; +import com.formdev.flatlaf.FlatLightLaf; public enum LookAndFeel { DEFAULT("Default"), DARCULA("Darcula"), + METAL("Metal"), SYSTEM("System"), NONE("None (JVM default)"); // the "JVM default" look and feel, get it at the beginning and store it so we can set it later - private static javax.swing.LookAndFeel NONE_LAF = UIManager.getLookAndFeel(); + private static final javax.swing.LookAndFeel NONE_LAF = UIManager.getLookAndFeel(); private final String name; LookAndFeel(String name) { @@ -35,10 +37,13 @@ public enum LookAndFeel { UIManager.setLookAndFeel(NONE_LAF); break; case DEFAULT: + UIManager.setLookAndFeel(new FlatLightLaf()); + break; + case METAL: UIManager.setLookAndFeel(new MetalLookAndFeel()); break; case DARCULA: - UIManager.setLookAndFeel(new DarculaLaf()); + UIManager.setLookAndFeel(new FlatDarculaLaf()); break; case SYSTEM: UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); -- cgit v1.2.3