Added Default Component Icons

Fixes #84
This commit is contained in:
Konloch 2021-07-16 14:49:32 -07:00
parent 995158a8d2
commit cf6378d334
5 changed files with 50 additions and 13 deletions

View file

@ -28,6 +28,7 @@ public class Configuration
public static boolean displayParentInTab = false; //also change in the main GUI public static boolean displayParentInTab = false; //also change in the main GUI
public static boolean simplifiedTabNames = false; public static boolean simplifiedTabNames = false;
public static boolean forceResourceUpdateFromClassNode = false; //TODO add to GUI public static boolean forceResourceUpdateFromClassNode = false; //TODO add to GUI
public static boolean showDarkLAFComponentIcons = false;
public static boolean currentlyDumping = false; public static boolean currentlyDumping = false;
public static boolean needsReDump = true; public static boolean needsReDump = true;
public static boolean warnForEditing = false; public static boolean warnForEditing = false;

View file

@ -1,5 +1,10 @@
package the.bytecode.club.bytecodeviewer.gui.components; 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; import javax.swing.JInternalFrame;
/*************************************************************************** /***************************************************************************
@ -33,7 +38,19 @@ public abstract class VisibleComponent extends JInternalFrame
public VisibleComponent(final String title) public VisibleComponent(final String title)
{ {
super(title, false, false, false, false); 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; private static final long serialVersionUID = -6453413772343643526L;

View file

@ -1,22 +1,25 @@
package the.bytecode.club.bytecodeviewer.gui.resourceviewer; package the.bytecode.club.bytecodeviewer.gui.resourceviewer;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.Rectangle;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; 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 java.util.HashSet;
import javax.swing.JButton; import javax.imageio.ImageIO;
import javax.swing.JMenuItem; import javax.swing.*;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JTabbedPane;
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.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ClassViewer; 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.FileViewer;
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ResourceViewer; 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.Translation;
import the.bytecode.club.bytecodeviewer.translation.components.TranslatedJButton; import the.bytecode.club.bytecodeviewer.translation.components.TranslatedJButton;
import the.bytecode.club.bytecodeviewer.translation.components.TranslatedVisibleComponent; import the.bytecode.club.bytecodeviewer.translation.components.TranslatedVisibleComponent;

View file

@ -2,6 +2,9 @@ package the.bytecode.club.bytecodeviewer.gui.theme;
import com.github.weisj.darklaf.LafManager; import com.github.weisj.darklaf.LafManager;
import com.github.weisj.darklaf.theme.*; 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 the.bytecode.club.bytecodeviewer.translation.Translation;
import javax.swing.*; import javax.swing.*;
@ -51,13 +54,13 @@ public enum LAFTheme
public void setLAF() throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException public void setLAF() throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException
{ {
boolean testLAF = true; boolean darkLAF = true;
switch(this) switch(this)
{ {
default: default:
case SYSTEM: case SYSTEM:
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
testLAF = false; darkLAF = false;
break; break;
case DARK: case DARK:
@ -90,8 +93,19 @@ public enum LAFTheme
} }
//test theme installed correctly //test theme installed correctly
if(testLAF) if(darkLAF)
{
failSafe(); failSafe();
}
Configuration.showDarkLAFComponentIcons = darkLAF;
if(BytecodeViewer.viewer != null)
{
BytecodeViewer.viewer.resourcePane.setDefaultIcon();
BytecodeViewer.viewer.workPane.setDefaultIcon();
BytecodeViewer.viewer.searchBoxPane.setDefaultIcon();
}
} }
/** /**

View file

@ -1,6 +1,8 @@
package the.bytecode.club.bytecodeviewer.translation.components; 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.components.VisibleComponent;
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.Workspace;
import the.bytecode.club.bytecodeviewer.translation.TranslatedComponentReference; import the.bytecode.club.bytecodeviewer.translation.TranslatedComponentReference;
import the.bytecode.club.bytecodeviewer.translation.Translation; import the.bytecode.club.bytecodeviewer.translation.Translation;