diff options
| author | 2021-03-15 13:36:34 +0200 | |
|---|---|---|
| committer | 2021-03-15 13:36:34 +0200 | |
| commit | a4246b6166b45ac79c87c42d2a56bc7f95205a62 (patch) | |
| tree | 8f531922742ac6fa59ee0b4c1a49bf1c66383df0 | |
| parent | Bump version (diff) | |
| download | enigma-fork-a4246b6166b45ac79c87c42d2a56bc7f95205a62.tar.gz enigma-fork-a4246b6166b45ac79c87c42d2a56bc7f95205a62.tar.xz enigma-fork-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.
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | enigma-swing/build.gradle | 2 | ||||
| -rw-r--r-- | enigma-swing/src/main/java/cuchaz/enigma/gui/config/LookAndFeel.java | 11 | ||||
| -rw-r--r-- | enigma/src/main/resources/lang/en_us.json | 1 |
4 files changed, 11 insertions, 5 deletions
| @@ -11,7 +11,7 @@ Enigma includes the following open-source libraries: | |||
| 11 | - A [modified version](https://github.com/FabricMC/cfr) of [CFR](https://github.com/leibnitz27/cfr) (MIT) | 11 | - A [modified version](https://github.com/FabricMC/cfr) of [CFR](https://github.com/leibnitz27/cfr) (MIT) |
| 12 | - [Guava](https://github.com/google/guava) (Apache-2.0) | 12 | - [Guava](https://github.com/google/guava) (Apache-2.0) |
| 13 | - [SyntaxPane](https://github.com/Sciss/SyntaxPane) (Apache-2.0) | 13 | - [SyntaxPane](https://github.com/Sciss/SyntaxPane) (Apache-2.0) |
| 14 | - [Darcula](https://github.com/bulenkov/Darcula) (Apache-2.0) | 14 | - [FlatLaf](https://github.com/JFormDesigner/FlatLaf) (Apache-2.0) |
| 15 | - [jopt-simple](https://github.com/jopt-simple/jopt-simple) (MIT) | 15 | - [jopt-simple](https://github.com/jopt-simple/jopt-simple) (MIT) |
| 16 | - [ASM](https://asm.ow2.io/) (BSD-3-Clause) | 16 | - [ASM](https://asm.ow2.io/) (BSD-3-Clause) |
| 17 | 17 | ||
diff --git a/enigma-swing/build.gradle b/enigma-swing/build.gradle index 2966ae7..e0f6f66 100644 --- a/enigma-swing/build.gradle +++ b/enigma-swing/build.gradle | |||
| @@ -8,7 +8,7 @@ dependencies { | |||
| 8 | implementation project(':enigma-server') | 8 | implementation project(':enigma-server') |
| 9 | 9 | ||
| 10 | implementation 'net.sf.jopt-simple:jopt-simple:6.0-alpha-3' | 10 | implementation 'net.sf.jopt-simple:jopt-simple:6.0-alpha-3' |
| 11 | implementation 'com.bulenkov:darcula:1.0.0-bobbylight' | 11 | implementation 'com.formdev:flatlaf:1.0' |
| 12 | implementation 'de.sciss:syntaxpane:1.2.0' | 12 | implementation 'de.sciss:syntaxpane:1.2.0' |
| 13 | implementation 'com.github.lukeu:swing-dpi:0.6' | 13 | implementation 'com.github.lukeu:swing-dpi:0.6' |
| 14 | implementation 'org.drjekyll:fontchooser:2.4' | 14 | 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 1c70d43..d1d3e0d 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; | |||
| 8 | import javax.swing.UIManager; | 8 | import javax.swing.UIManager; |
| 9 | import javax.swing.plaf.metal.MetalLookAndFeel; | 9 | import javax.swing.plaf.metal.MetalLookAndFeel; |
| 10 | 10 | ||
| 11 | import com.bulenkov.darcula.DarculaLaf; | 11 | import com.formdev.flatlaf.FlatDarculaLaf; |
| 12 | import com.formdev.flatlaf.FlatLightLaf; | ||
| 12 | 13 | ||
| 13 | public enum LookAndFeel { | 14 | public 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()); |
diff --git a/enigma/src/main/resources/lang/en_us.json b/enigma/src/main/resources/lang/en_us.json index 8195bb1..8862f22 100644 --- a/enigma/src/main/resources/lang/en_us.json +++ b/enigma/src/main/resources/lang/en_us.json | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | "menu.view.themes": "Themes", | 36 | "menu.view.themes": "Themes", |
| 37 | "menu.view.themes.default": "Default", | 37 | "menu.view.themes.default": "Default", |
| 38 | "menu.view.themes.darcula": "Darcula", | 38 | "menu.view.themes.darcula": "Darcula", |
| 39 | "menu.view.themes.metal": "Metal", | ||
| 39 | "menu.view.themes.system": "System", | 40 | "menu.view.themes.system": "System", |
| 40 | "menu.view.themes.none": "None (JVM Default)", | 41 | "menu.view.themes.none": "None (JVM Default)", |
| 41 | "menu.view.languages": "Languages", | 42 | "menu.view.languages": "Languages", |