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. --- README.md | 2 +- enigma-swing/build.gradle | 2 +- .../src/main/java/cuchaz/enigma/gui/config/LookAndFeel.java | 11 ++++++++--- enigma/src/main/resources/lang/en_us.json | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fac036f4..f3ab4c79 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Enigma includes the following open-source libraries: - A [modified version](https://github.com/FabricMC/cfr) of [CFR](https://github.com/leibnitz27/cfr) (MIT) - [Guava](https://github.com/google/guava) (Apache-2.0) - [SyntaxPane](https://github.com/Sciss/SyntaxPane) (Apache-2.0) - - [Darcula](https://github.com/bulenkov/Darcula) (Apache-2.0) + - [FlatLaf](https://github.com/JFormDesigner/FlatLaf) (Apache-2.0) - [jopt-simple](https://github.com/jopt-simple/jopt-simple) (MIT) - [ASM](https://asm.ow2.io/) (BSD-3-Clause) 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()); diff --git a/enigma/src/main/resources/lang/en_us.json b/enigma/src/main/resources/lang/en_us.json index 8195bb1f..8862f22d 100644 --- a/enigma/src/main/resources/lang/en_us.json +++ b/enigma/src/main/resources/lang/en_us.json @@ -36,6 +36,7 @@ "menu.view.themes": "Themes", "menu.view.themes.default": "Default", "menu.view.themes.darcula": "Darcula", + "menu.view.themes.metal": "Metal", "menu.view.themes.system": "System", "menu.view.themes.none": "None (JVM Default)", "menu.view.languages": "Languages", -- cgit v1.2.3