Added DarkLAF

I had a few issues with DarkLaf so as a backup I kept the old Darcula Theme as well.

DarkLaf is based off of Darcula so they are very similar, eventually it may be better to drop Darcula support for DarkLaf once all of the bugs are resolved.
This commit is contained in:
Konloch 2021-06-28 17:05:18 -07:00
parent db0dbdb9dc
commit 2421bd3a30
5 changed files with 37 additions and 5 deletions

View file

@ -224,6 +224,11 @@
<artifactId>darcula</artifactId> <artifactId>darcula</artifactId>
<version>2017.11bcv</version> <version>2017.11bcv</version>
</dependency> </dependency>
<dependency>
<groupId>com.github.weisj</groupId>
<artifactId>darklaf-core</artifactId>
<version>2.5.5</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

View file

@ -175,6 +175,7 @@ public class BytecodeViewer
"Make sure to watch the repo: https://github.com/Konloch/bytecode-viewer for " + VERSION + "'s release"); "Make sure to watch the repo: https://github.com/Konloch/bytecode-viewer for " + VERSION + "'s release");
viewer = new MainViewerGUI(); viewer = new MainViewerGUI();
SwingUtilities.updateComponentTreeUI(viewer);
Settings.loadSettings(); Settings.loadSettings();
int CLI = CommandLineInput.parseCommandLine(args); int CLI = CommandLineInput.parseCommandLine(args);

View file

@ -37,6 +37,6 @@ public class Configuration
public static long lastHotKeyExecuted = System.currentTimeMillis(); public static long lastHotKeyExecuted = System.currentTimeMillis();
public static LAFTheme lafTheme = LAFTheme.LIGHT; //lightmode by default since it uses the system theme public static LAFTheme lafTheme = LAFTheme.SYSTEM; //lightmode by default since it uses the system theme
public static RSTATheme rstaTheme = lafTheme.getRSTATheme(); public static RSTATheme rstaTheme = lafTheme.getRSTATheme();
} }

View file

@ -3,9 +3,11 @@ package the.bytecode.club.bytecodeviewer.gui.components;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rtextarea.RTextScrollPane; import org.fife.ui.rtextarea.RTextScrollPane;
import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Configuration;
import the.bytecode.club.bytecodeviewer.Resources; import the.bytecode.club.bytecodeviewer.Resources;
import the.bytecode.club.bytecodeviewer.gui.components.listeners.PressKeyListener; import the.bytecode.club.bytecodeviewer.gui.components.listeners.PressKeyListener;
import the.bytecode.club.bytecodeviewer.gui.components.listeners.ReleaseKeyListener; import the.bytecode.club.bytecodeviewer.gui.components.listeners.ReleaseKeyListener;
import the.bytecode.club.bytecodeviewer.gui.theme.LAFTheme;
import the.bytecode.club.bytecodeviewer.util.JTextAreaUtils; import the.bytecode.club.bytecodeviewer.util.JTextAreaUtils;
import javax.swing.*; import javax.swing.*;
@ -44,9 +46,20 @@ public class SearchableRSyntaxTextArea extends RSyntaxTextArea
private final JTextField searchInput = new JTextField(); private final JTextField searchInput = new JTextField();
private final JCheckBox caseSensitiveSearch = new JCheckBox("Exact"); private final JCheckBox caseSensitiveSearch = new JCheckBox("Exact");
private final JLabel titleHeader = new JLabel(""); private final JLabel titleHeader = new JLabel("");
private final Color scrollBackground = new Color(0x3c3f41);
private final Color scrollForeground = new Color(0x575859);
public SearchableRSyntaxTextArea() public SearchableRSyntaxTextArea()
{ {
if(Configuration.lafTheme == LAFTheme.BETTER_DARK)
{
//this fixes the white border on the jScrollBar panes
scrollPane.getHorizontalScrollBar().setBackground(scrollBackground);
scrollPane.getHorizontalScrollBar().setForeground(scrollForeground);
scrollPane.getVerticalScrollBar().setBackground(scrollBackground);
scrollPane.getVerticalScrollBar().setForeground(scrollForeground);
}
setAntiAliasingEnabled(true); setAntiAliasingEnabled(true);
scrollPane.setColumnHeaderView(searchPanel); scrollPane.setColumnHeaderView(searchPanel);

View file

@ -1,6 +1,9 @@
package the.bytecode.club.bytecodeviewer.gui.theme; package the.bytecode.club.bytecodeviewer.gui.theme;
import com.bulenkov.darcula.DarculaLaf; import com.bulenkov.darcula.DarculaLaf;
import com.github.weisj.darklaf.LafManager;
import com.github.weisj.darklaf.theme.DarculaTheme;
import com.github.weisj.darklaf.theme.IntelliJTheme;
import javax.swing.*; import javax.swing.*;
@ -11,8 +14,10 @@ import javax.swing.*;
*/ */
public enum LAFTheme public enum LAFTheme
{ {
LIGHT("Light Theme (Requires restart)", RSTATheme.DEFAULT), //System theme SYSTEM("System Theme (Fast)", RSTATheme.DEFAULT), //System theme
DARK("Dark Theme (Requires restart)", RSTATheme.DARK), //Darcula DARK("Dark Theme (Fast)", RSTATheme.DARK), //Darcula 2017
BETTER_DARK("Better Dark Theme (Slow)", RSTATheme.DARK), //Darcula 2021
LIGHT("Light Theme (Slow)", RSTATheme.DEFAULT), //Intellij theme
; ;
private final String readableName; private final String readableName;
@ -39,13 +44,21 @@ public enum LAFTheme
switch(this) switch(this)
{ {
default: default:
case LIGHT: case SYSTEM:
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
break; break;
case DARK: case DARK:
UIManager.setLookAndFeel(new DarculaLaf()); UIManager.setLookAndFeel(new DarculaLaf());
break; break;
case BETTER_DARK:
LafManager.install(new DarculaTheme());
break;
case LIGHT:
LafManager.install(new IntelliJTheme());
break;
} }
} }
} }