summaryrefslogtreecommitdiff
path: root/src/main/java/cuchaz/enigma/config/Themes.java
diff options
context:
space:
mode:
authorGravatar modmuss502017-06-07 15:42:45 +0100
committerGravatar asie2018-11-28 09:53:27 +0100
commitef3532566332d96914a44641b22f0cb628a8e109 (patch)
treeac61d756124a9ee47344380135d2eb9145ebc6d7 /src/main/java/cuchaz/enigma/config/Themes.java
parentfix #68 (diff)
downloadenigma-fork-ef3532566332d96914a44641b22f0cb628a8e109.tar.gz
enigma-fork-ef3532566332d96914a44641b22f0cb628a8e109.tar.xz
enigma-fork-ef3532566332d96914a44641b22f0cb628a8e109.zip
Add dark LAF
Diffstat (limited to 'src/main/java/cuchaz/enigma/config/Themes.java')
-rw-r--r--src/main/java/cuchaz/enigma/config/Themes.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/cuchaz/enigma/config/Themes.java b/src/main/java/cuchaz/enigma/config/Themes.java
index 04ecfde..4b1f478 100644
--- a/src/main/java/cuchaz/enigma/config/Themes.java
+++ b/src/main/java/cuchaz/enigma/config/Themes.java
@@ -1,5 +1,6 @@
1package cuchaz.enigma.config; 1package cuchaz.enigma.config;
2 2
3import com.bulenkov.darcula.DarculaLaf;
3import cuchaz.enigma.gui.Gui; 4import cuchaz.enigma.gui.Gui;
4import cuchaz.enigma.gui.MinecraftSyntaxKit; 5import cuchaz.enigma.gui.MinecraftSyntaxKit;
5import cuchaz.enigma.gui.highlight.DeobfuscatedHighlightPainter; 6import cuchaz.enigma.gui.highlight.DeobfuscatedHighlightPainter;
@@ -7,6 +8,7 @@ import cuchaz.enigma.gui.highlight.ObfuscatedHighlightPainter;
7import cuchaz.enigma.gui.highlight.OtherHighlightPainter; 8import cuchaz.enigma.gui.highlight.OtherHighlightPainter;
8import de.sciss.syntaxpane.DefaultSyntaxKit; 9import de.sciss.syntaxpane.DefaultSyntaxKit;
9 10
11import javax.swing.*;
10import java.awt.*; 12import java.awt.*;
11import java.io.IOException; 13import java.io.IOException;
12 14
@@ -43,6 +45,7 @@ public class Themes {
43 Config.getInstance().typeColor = 0xF8F8F2; 45 Config.getInstance().typeColor = 0xF8F8F2;
44 Config.getInstance().identifierColor = 0xF8F8F2; 46 Config.getInstance().identifierColor = 0xF8F8F2;
45 Config.getInstance().defaultTextColor = 0xF8F8F2; 47 Config.getInstance().defaultTextColor = 0xF8F8F2;
48 Config.getInstance().useDraculaLAF = true;
46 updateTheme(gui); 49 updateTheme(gui);
47 } 50 }
48 51
@@ -60,7 +63,20 @@ public class Themes {
60 gui.otherHighlightPainter = new OtherHighlightPainter(); 63 gui.otherHighlightPainter = new OtherHighlightPainter();
61 gui.editor.updateUI(); 64 gui.editor.updateUI();
62 gui.editor.setBackground(new Color(Config.getInstance().editorBackground)); 65 gui.editor.setBackground(new Color(Config.getInstance().editorBackground));
66 setLAF();
67 SwingUtilities.updateComponentTreeUI(gui.getFrame());
63 gui.getController().refreshCurrentClass(); 68 gui.getController().refreshCurrentClass();
64 } 69 }
65 70
71 public static void setLAF(){
72 try {
73 if (Config.getInstance().useDraculaLAF){
74 UIManager.setLookAndFeel(new DarculaLaf());
75 } else if (Config.getInstance().useSystemLAF)
76 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
77 } catch (Exception e){
78 throw new Error("Failed to set LAF", e);
79 }
80 }
81
66} 82}