diff --git a/libs/com/github/weisj/darklaf-bcv/2.6.2bcv/darklaf-bcv-2.6.2bcv.jar b/libs/com/github/weisj/darklaf-bcv/2.6.2bcv/darklaf-bcv-2.6.2bcv.jar deleted file mode 100644 index 8aa8a372..00000000 Binary files a/libs/com/github/weisj/darklaf-bcv/2.6.2bcv/darklaf-bcv-2.6.2bcv.jar and /dev/null differ diff --git a/libs/com/github/weisj/darklaf-bcv/2.6.2bcv/darklaf-bcv-2.6.2bcv.jar.md5 b/libs/com/github/weisj/darklaf-bcv/2.6.2bcv/darklaf-bcv-2.6.2bcv.jar.md5 deleted file mode 100644 index 470a111e..00000000 --- a/libs/com/github/weisj/darklaf-bcv/2.6.2bcv/darklaf-bcv-2.6.2bcv.jar.md5 +++ /dev/null @@ -1 +0,0 @@ -41d368cd63ae76bba69ccb6e967866fe \ No newline at end of file diff --git a/libs/com/github/weisj/darklaf-bcv/2.6.2bcv/darklaf-bcv-2.6.2bcv.jar.sha1 b/libs/com/github/weisj/darklaf-bcv/2.6.2bcv/darklaf-bcv-2.6.2bcv.jar.sha1 deleted file mode 100644 index f014ee80..00000000 --- a/libs/com/github/weisj/darklaf-bcv/2.6.2bcv/darklaf-bcv-2.6.2bcv.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -96f9c3d3bee336c4653abf42444c025b6dfd1836 \ No newline at end of file diff --git a/libs/com/github/weisj/darklaf-bcv/2.6.2bcv/darklaf-bcv-2.6.2bcv.pom b/libs/com/github/weisj/darklaf-bcv/2.6.2bcv/darklaf-bcv-2.6.2bcv.pom deleted file mode 100644 index 0b80d015..00000000 --- a/libs/com/github/weisj/darklaf-bcv/2.6.2bcv/darklaf-bcv-2.6.2bcv.pom +++ /dev/null @@ -1,8 +0,0 @@ - - - 4.0.0 - com.github.weisj - darklaf-bcv - 2.6.2bcv - diff --git a/libs/com/github/weisj/darklaf-bcv/2.6.2bcv/darklaf-bcv-2.6.2bcv.pom.md5 b/libs/com/github/weisj/darklaf-bcv/2.6.2bcv/darklaf-bcv-2.6.2bcv.pom.md5 deleted file mode 100644 index c4d5cfce..00000000 --- a/libs/com/github/weisj/darklaf-bcv/2.6.2bcv/darklaf-bcv-2.6.2bcv.pom.md5 +++ /dev/null @@ -1 +0,0 @@ -74478ea2fe1166fa888c71a79567301d \ No newline at end of file diff --git a/libs/com/github/weisj/darklaf-bcv/2.6.2bcv/darklaf-bcv-2.6.2bcv.pom.sha1 b/libs/com/github/weisj/darklaf-bcv/2.6.2bcv/darklaf-bcv-2.6.2bcv.pom.sha1 deleted file mode 100644 index 5bf61320..00000000 --- a/libs/com/github/weisj/darklaf-bcv/2.6.2bcv/darklaf-bcv-2.6.2bcv.pom.sha1 +++ /dev/null @@ -1 +0,0 @@ -d30064114889fe65ffd7c6c27f295351dec57586 \ No newline at end of file diff --git a/libs/com/github/weisj/darklaf-bcv/maven-metadata.xml b/libs/com/github/weisj/darklaf-bcv/maven-metadata.xml deleted file mode 100644 index dbd34aeb..00000000 --- a/libs/com/github/weisj/darklaf-bcv/maven-metadata.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - com.github.weisj - darklaf-bcv - - 2.6.2bcv - - 2.6.2bcv - - 20210724002216 - - diff --git a/libs/com/github/weisj/darklaf-bcv/maven-metadata.xml.md5 b/libs/com/github/weisj/darklaf-bcv/maven-metadata.xml.md5 deleted file mode 100644 index 4c4b66d9..00000000 --- a/libs/com/github/weisj/darklaf-bcv/maven-metadata.xml.md5 +++ /dev/null @@ -1 +0,0 @@ -75dd4d459bc5baedf71904887dc0b60e \ No newline at end of file diff --git a/libs/com/github/weisj/darklaf-bcv/maven-metadata.xml.sha1 b/libs/com/github/weisj/darklaf-bcv/maven-metadata.xml.sha1 deleted file mode 100644 index 0a9234a0..00000000 --- a/libs/com/github/weisj/darklaf-bcv/maven-metadata.xml.sha1 +++ /dev/null @@ -1 +0,0 @@ -cc64fe02e94fab19ada3c4e39a6d984d5bf541b1 \ No newline at end of file diff --git a/pom.xml b/pom.xml index ed335b9d..800eb668 100644 --- a/pom.xml +++ b/pom.xml @@ -17,10 +17,6 @@ local-maven-repo file:///${project.basedir}/libs - - sonatype-snapshots - https://oss.sonatype.org/content/repositories/snapshots - jitpack.io https://jitpack.io @@ -86,7 +82,7 @@ org.codehaus.janino commons-compiler - 3.1.4 + 3.1.6 org.apache.commons @@ -131,7 +127,7 @@ org.codehaus.janino janino - 3.1.4 + 3.1.6 com.jd @@ -225,8 +221,8 @@ com.github.weisj - darklaf-bcv - 2.6.2bcv + darklaf-core + 2.7.2 com.github.weisj diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java b/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java index 12156ba7..8e15cf6b 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java @@ -84,7 +84,7 @@ import static the.bytecode.club.bytecodeviewer.Constants.*; * * TODO DarkLAF Specific Bugs: * + Resource List creates swing lag with large project - * + JMenuBar can only be displayed on a JFrame, a work around is needed for this + * + JMenuBar can only be displayed on a JFrame, a work around is needed for this (Partially solved) * * TODO IN-PROGRESS: * + Resource Exporter/Save/Decompile As Zip needs to be rewritten 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 813ef2e7..4c348673 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 @@ -3,8 +3,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.gui.theme.LAFTheme; import the.bytecode.club.bytecodeviewer.resources.IconResources; +import javax.swing.BorderFactory; import javax.swing.JInternalFrame; /*************************************************************************** @@ -40,7 +42,16 @@ public abstract class VisibleComponent extends JInternalFrame super(title, false, false, false, false); this.setDefaultIcon(); } - + + @Override + public void updateUI() { + if (Configuration.lafTheme != LAFTheme.SYSTEM) + setBorder(BorderFactory.createEmptyBorder()); + else + setBorder(null); + super.updateUI(); + } + public void setDefaultIcon() { try { diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/JHexEditor.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/JHexEditor.java index 8071b0f0..7ba77848 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/JHexEditor.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/JHexEditor.java @@ -1,5 +1,7 @@ package the.bytecode.club.bytecodeviewer.gui.hexviewer; +import java.awt.Graphics2D; +import java.awt.RenderingHints; import the.bytecode.club.bytecodeviewer.BytecodeViewer; import java.awt.BorderLayout; @@ -160,8 +162,11 @@ public class JHexEditor extends JPanel implements FocusListener, AdjustmentListe fn.getHeight() + 1); } - protected void printString(Graphics g, String s, int x, int y) { + protected void printString(Graphics graphics, String s, int x, int y) { + Graphics2D g = (Graphics2D) graphics; FontMetrics fn = getFontMetrics(font); + g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g.drawString(s, ((fn.stringWidth(" ") + 1) * x) + border, ((fn.getHeight() * (y + 1)) - fn.getMaxDescent()) + border); } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ResourceTree.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ResourceTree.java index e41eda07..e461824d 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ResourceTree.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ResourceTree.java @@ -43,17 +43,20 @@ public class ResourceTree extends JTree StringMetricsUtil m = null; @Override - public void paint(final Graphics g) + public void paint(final Graphics graphics) { try { + Graphics2D g = (Graphics2D) graphics; super.paint(g); if (m == null) { - m = new StringMetricsUtil((Graphics2D) g); + m = new StringMetricsUtil(g); } if (treeRoot.getChildCount() < 1) { + g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g.setColor(new Color(0, 0, 0, 100)); g.fillRect(0, 0, getWidth(), getHeight()); g.setColor(Color.white); @@ -63,7 +66,7 @@ public class ResourceTree extends JTree getHeight() / 2); } } - catch (InternalError | NullPointerException ignored) + catch (InternalError | NullPointerException | ClassCastException ignored) { } } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginWriter.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginWriter.java index e8871789..c2f982c0 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginWriter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginWriter.java @@ -6,7 +6,6 @@ import org.apache.commons.compress.utils.FileNameUtils; import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.Configuration; import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ComponentViewer; -import the.bytecode.club.bytecodeviewer.gui.theme.LAFTheme; import the.bytecode.club.bytecodeviewer.resources.IconResources; import the.bytecode.club.bytecodeviewer.gui.components.FileChooser; import the.bytecode.club.bytecodeviewer.gui.components.SearchableRSyntaxTextArea; @@ -18,6 +17,7 @@ import the.bytecode.club.bytecodeviewer.util.MiscUtils; import the.bytecode.club.bytecodeviewer.util.SyntaxLanguage; import javax.swing.*; +import javax.swing.border.LineBorder; import java.awt.*; import java.io.File; import java.io.IOException; @@ -123,16 +123,18 @@ public class PluginWriter extends JFrame JPanel p = new JPanel(new BorderLayout()); JPanel p2 = new JPanel(new BorderLayout()); - p.add(p2, BorderLayout.NORTH); p.add(component, BorderLayout.CENTER); - - if(Configuration.lafTheme == LAFTheme.SYSTEM) - p2.add(getJMenuBar(), BorderLayout.CENTER); - else //TODO DarkLAF wont display the jMenuBar due to how it handles them, instead display the menu - //TODO make the menu interactable and display the menu manually - p2.add(getJMenuBar().getMenu(0), BorderLayout.CENTER); - + + JMenuBar menuBar = getJMenuBar(); + // As the Darklaf windows decorations steal the menu bar from the frame + // it sets the preferred size to (0,0). Because we want to steal the menu bar ourselves. + // we have to revert this change. + // Remove when https://github.com/weisJ/darklaf/issues/258 is fixed and available in a + // release. + menuBar.setPreferredSize(null); + p2.add(menuBar, BorderLayout.CENTER); + ComponentViewer.addComponentAsTab(pluginName, p); } else diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/resources/ResourceContainerImporter.java b/src/main/java/the/bytecode/club/bytecodeviewer/resources/ResourceContainerImporter.java index 62062823..ae14a3dc 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/resources/ResourceContainerImporter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/resources/ResourceContainerImporter.java @@ -73,16 +73,18 @@ public class ResourceContainerImporter try { //attempt to import using Java ZipInputStream - importZipInputStream(false); + return importZipInputStream(false); } - catch (IOException e) + catch (Throwable t) { - e.printStackTrace(); - - //fallback to apache commons ZipFile - importApacheZipFile(false); + try { + //fallback to apache commons ZipFile + return importApacheZipFile(false); + } catch (Throwable t1) { + t1.addSuppressed(t); + throw t1; + } } - return this; } /** @@ -93,10 +95,10 @@ public class ResourceContainerImporter { //TODO remove this .class check and just look for cafebabe if (name.endsWith(".class")) - addClassResource(name, stream); - else if(!classesOnly) - addResource(name, stream); - + return addClassResource(name, stream); + else if (!classesOnly) + return addResource(name, stream); + return this; } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedJMenu.java b/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedJMenu.java index e5f77be9..e0a78a86 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedJMenu.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedJMenu.java @@ -44,4 +44,10 @@ public class TranslatedJMenu extends JMenu componentReference.translate(); } } + + @Override + public boolean isEnabled() + { + return super.isEnabled() && getMenuComponentCount() > 0; + } } \ No newline at end of file diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/util/FileDrop.java b/src/main/java/the/bytecode/club/bytecodeviewer/util/FileDrop.java index e3cf56c6..2b74a904 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/util/FileDrop.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/util/FileDrop.java @@ -444,10 +444,10 @@ public class FileDrop { boolean support; try { final Class arbitraryDndClass = Class - .forName("DnDConstants"); + .forName("java.awt.dnd.DnDConstants"); support = true; } // end try - catch (final Exception e) { + catch (final Throwable t) { support = false; } // end catch supportsDnD = support;