Unverified Commit f8c0449d authored by skylot's avatar skylot Committed by GitHub

feat(gui): add icons to jadx-gui (#420) (PR #428)

parent b28eaa1a
...@@ -56,7 +56,7 @@ launch4j { ...@@ -56,7 +56,7 @@ launch4j {
mainClassName = 'jadx.gui.JadxGUI' mainClassName = 'jadx.gui.JadxGUI'
copyConfigurable = project.tasks.shadowJar.outputs.files copyConfigurable = project.tasks.shadowJar.outputs.files
jar = "lib/${project.tasks.shadowJar.archiveName}" jar = "lib/${project.tasks.shadowJar.archiveName}"
// icon = "${projectDir}/icons/myApp.ico" icon = "${projectDir}/src/main/resources/logos/jadx-logo.ico"
outfile = "jadx-gui-${version}.exe" outfile = "jadx-gui-${version}.exe"
copyright = 'Skylot' copyright = 'Skylot'
windowTitle = 'jadx' windowTitle = 'jadx'
......
...@@ -23,7 +23,9 @@ import java.awt.event.MouseAdapter; ...@@ -23,7 +23,9 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
...@@ -114,6 +116,16 @@ public class MainWindow extends JFrame { ...@@ -114,6 +116,16 @@ public class MainWindow extends JFrame {
registerBundledFonts(); registerBundledFonts();
initUI(); initUI();
initMenuAndToolbar(); initMenuAndToolbar();
setWindowIcons();
}
private void setWindowIcons() {
List<Image> icons = new ArrayList<>();
icons.add(Utils.openImage("/logos/jadx-logo-16px.png"));
icons.add(Utils.openImage("/logos/jadx-logo-32px.png"));
icons.add(Utils.openImage("/logos/jadx-logo-48px.png"));
icons.add(Utils.openImage("/logos/jadx-logo.png"));
setIconImages(icons);
loadSettings(); loadSettings();
checkForUpdate(); checkForUpdate();
} }
......
...@@ -48,6 +48,14 @@ public class Utils { ...@@ -48,6 +48,14 @@ public class Utils {
return new ImageIcon(resource); return new ImageIcon(resource);
} }
public static Image openImage(String path) {
URL resource = Utils.class.getResource(path);
if (resource == null) {
throw new JadxRuntimeException("Image not found: " + path);
}
return Toolkit.getDefaultToolkit().createImage(resource);
}
@Nullable @Nullable
public static Font openFontTTF(String name) { public static Font openFontTTF(String name) {
String fontPath = "/fonts/" + name + ".ttf"; String fontPath = "/fonts/" + name + ".ttf";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment