Skip to content

Commit

Permalink
feat(gui): add icons to jadx-gui (#420) (PR #428)
Browse files Browse the repository at this point in the history
  • Loading branch information
skylot committed Jan 23, 2019
1 parent b28eaa1 commit f8c0449
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion jadx-gui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,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
12 changes: 12 additions & 0 deletions jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,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 Down Expand Up @@ -114,6 +116,16 @@ public MainWindow(JadxSettings settings) {
registerBundledFonts();
initUI();
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();
checkForUpdate();
}
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 @@ -48,6 +48,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 f8c0449

Please sign in to comment.