Skip to content

Commit 949e2b3

Browse files
committed
Fix app icon on macOS
1 parent 9983e43 commit 949e2b3

File tree

3 files changed

+4
-14
lines changed

3 files changed

+4
-14
lines changed

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

icons/blob_emoji.icns

418 KB
Binary file not shown.

src/main/java/com/airsquared/blobsaver/Main.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -147,23 +147,13 @@ public void init() {
147147
}
148148

149149
@Override
150-
@SuppressWarnings("unchecked")
151-
public void start(Stage primaryStage) throws IOException, ReflectiveOperationException {
150+
public void start(Stage primaryStage) throws IOException {
152151
Main.primaryStage = primaryStage;
153-
Parent root = null;
154-
try {
155-
root = FXMLLoader.load(getClass().getResource("blobsaver.fxml"));
156-
} catch (Exception e) {
157-
e.printStackTrace();
158-
System.exit(-1);
159-
}
152+
Parent root = FXMLLoader.load(getClass().getResource("blobsaver.fxml"));
160153
primaryStage.setTitle("blobsaver " + Main.appVersion);
161154
primaryStage.setScene(new Scene(root));
162155
primaryStage.getScene().getStylesheets().add(getClass().getResource("app.css").toExternalForm());
163-
if (PlatformUtil.isMac()) { // setup the dock icon
164-
Class clazz = Class.forName("com.apple.eawt.Application");
165-
clazz.getMethod("setDockIconImage", java.awt.Image.class).invoke(clazz.getMethod("getApplication").invoke(null), javax.imageio.ImageIO.read(getClass().getResourceAsStream("blob_emoji.png")));
166-
} else {
156+
if (!PlatformUtil.isMac()) {
167157
primaryStage.getIcons().clear();
168158
primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("blob_emoji.png")));
169159
}

0 commit comments

Comments
 (0)