diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/Configuration.java b/src/main/java/the/bytecode/club/bytecodeviewer/Configuration.java index 586d5949..cc015054 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/Configuration.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/Configuration.java @@ -28,6 +28,7 @@ public class Configuration public static boolean displayParentInTab = false; //also change in the main GUI public static boolean simplifiedTabNames = false; public static boolean forceResourceUpdateFromClassNode = false; //TODO add to GUI + public static boolean showDarkLAFComponentIcons = false; public static boolean currentlyDumping = false; public static boolean needsReDump = true; public static boolean warnForEditing = false; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/VisibleComponent.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/VisibleComponent.java index cc1729b1..813ef2e7 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/VisibleComponent.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/VisibleComponent.java @@ -1,5 +1,10 @@ package the.bytecode.club.bytecodeviewer.gui.components; +import com.github.weisj.darklaf.icons.ThemedSVGIcon; +import the.bytecode.club.bytecodeviewer.Configuration; +import the.bytecode.club.bytecodeviewer.gui.resourceviewer.Workspace; +import the.bytecode.club.bytecodeviewer.resources.IconResources; + import javax.swing.JInternalFrame; /*************************************************************************** @@ -33,7 +38,19 @@ public abstract class VisibleComponent extends JInternalFrame public VisibleComponent(final String title) { super(title, false, false, false, false); - this.setFrameIcon(null); + this.setDefaultIcon(); + } + + public void setDefaultIcon() + { + try { + if(Configuration.showDarkLAFComponentIcons) + setFrameIcon(new ThemedSVGIcon(Workspace.class.getResource("/com/github/weisj/darklaf/icons/frame/frame.svg").toURI(), 16, 16)); + else + setFrameIcon(IconResources.jarIcon); + } catch (Exception e) { + e.printStackTrace(); + } } private static final long serialVersionUID = -6453413772343643526L; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/Workspace.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/Workspace.java index 51a9de36..a9ebd8c7 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/Workspace.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/Workspace.java @@ -1,22 +1,25 @@ package the.bytecode.club.bytecodeviewer.gui.resourceviewer; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.FlowLayout; -import java.awt.Rectangle; +import java.awt.*; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.util.HashSet; -import javax.swing.JButton; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.JTabbedPane; +import javax.imageio.ImageIO; +import javax.swing.*; +import com.github.weisj.darklaf.icons.ThemedSVGIcon; +import com.sun.java.swing.plaf.windows.WindowsInternalFrameTitlePane; +import me.konloch.kontainer.io.DiskWriter; import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ClassViewer; import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.FileViewer; import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ResourceViewer; +import the.bytecode.club.bytecodeviewer.resources.IconResources; import the.bytecode.club.bytecodeviewer.translation.Translation; import the.bytecode.club.bytecodeviewer.translation.components.TranslatedJButton; import the.bytecode.club.bytecodeviewer.translation.components.TranslatedVisibleComponent; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/theme/LAFTheme.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/theme/LAFTheme.java index dca45546..ad2967c9 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/theme/LAFTheme.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/theme/LAFTheme.java @@ -2,6 +2,9 @@ package the.bytecode.club.bytecodeviewer.gui.theme; import com.github.weisj.darklaf.LafManager; import com.github.weisj.darklaf.theme.*; +import the.bytecode.club.bytecodeviewer.BytecodeViewer; +import the.bytecode.club.bytecodeviewer.Configuration; +import the.bytecode.club.bytecodeviewer.gui.resourceviewer.BytecodeViewPanel; import the.bytecode.club.bytecodeviewer.translation.Translation; import javax.swing.*; @@ -51,13 +54,13 @@ public enum LAFTheme public void setLAF() throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException { - boolean testLAF = true; + boolean darkLAF = true; switch(this) { default: case SYSTEM: UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - testLAF = false; + darkLAF = false; break; case DARK: @@ -90,8 +93,19 @@ public enum LAFTheme } //test theme installed correctly - if(testLAF) + if(darkLAF) + { failSafe(); + } + + Configuration.showDarkLAFComponentIcons = darkLAF; + + if(BytecodeViewer.viewer != null) + { + BytecodeViewer.viewer.resourcePane.setDefaultIcon(); + BytecodeViewer.viewer.workPane.setDefaultIcon(); + BytecodeViewer.viewer.searchBoxPane.setDefaultIcon(); + } } /** diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedVisibleComponent.java b/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedVisibleComponent.java index c850d544..b1970193 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedVisibleComponent.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedVisibleComponent.java @@ -1,6 +1,8 @@ package the.bytecode.club.bytecodeviewer.translation.components; +import com.github.weisj.darklaf.icons.ThemedSVGIcon; import the.bytecode.club.bytecodeviewer.gui.components.VisibleComponent; +import the.bytecode.club.bytecodeviewer.gui.resourceviewer.Workspace; import the.bytecode.club.bytecodeviewer.translation.TranslatedComponentReference; import the.bytecode.club.bytecodeviewer.translation.Translation;