Skip to content

Commit

Permalink
feat(gui): add icons to jadx-gui (#420)
Browse files Browse the repository at this point in the history
  • Loading branch information
skylot committed Jan 12, 2019
1 parent 727285e commit 19ed8c2
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion jadx-gui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ launch4j {
mainClassName = 'jadx.gui.JadxGUI'
copyConfigurable = project.tasks.shadowJar.outputs.files
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"
copyright = 'Skylot'
windowTitle = 'jadx'
Expand Down
14 changes: 13 additions & 1 deletion jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;

Expand All @@ -49,9 +51,9 @@
import jadx.gui.update.JadxUpdate.IUpdateCallback;
import jadx.gui.update.data.Release;
import jadx.gui.utils.CacheObject;
import jadx.gui.utils.JumpPosition;
import jadx.gui.utils.Link;
import jadx.gui.utils.NLS;
import jadx.gui.utils.JumpPosition;
import jadx.gui.utils.Utils;

import static javax.swing.KeyStroke.getKeyStroke;
Expand Down Expand Up @@ -113,10 +115,20 @@ public MainWindow(JadxSettings settings) {
resetCache();
initUI();
initMenuAndToolbar();
setWindowIcons();
applySettings();
checkForUpdate();
}

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);
}

private void applySettings() {
setFont(settings.getFont());
setEditorTheme(settings.getEditorThemePath());
Expand Down
8 changes: 8 additions & 0 deletions jadx-gui/src/main/java/jadx/gui/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ public static ImageIcon openIcon(String name) {
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
public static Font openFontTTF(String name) {
String fontPath = "/fonts/" + name + ".ttf";
Expand Down
Binary file added jadx-gui/src/main/resources/logos/jadx-logo-16px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added jadx-gui/src/main/resources/logos/jadx-logo.ico
Binary file not shown.
Binary file added jadx-gui/src/main/resources/logos/jadx-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 19ed8c2

Please sign in to comment.