diff --git a/desktop/src/main/java/bisq/desktop/app/BisqApp.java b/desktop/src/main/java/bisq/desktop/app/BisqApp.java index fed66ca5f9e..186c472823b 100644 --- a/desktop/src/main/java/bisq/desktop/app/BisqApp.java +++ b/desktop/src/main/java/bisq/desktop/app/BisqApp.java @@ -253,18 +253,7 @@ private void setupStage(Scene scene) { stage.setScene(scene); stage.setMinWidth(MIN_WINDOW_WIDTH); stage.setMinHeight(MIN_WINDOW_HEIGHT); - - // on Windows the title icon is also used as task bar icon in a larger size - // on Linux no title icon is supported but also a large task bar icon is derived from that title icon - String iconPath; - if (Utilities.isOSX()) - iconPath = ImageUtil.isRetina() ? "/images/window_icon@2x.png" : "/images/window_icon.png"; - else if (Utilities.isWindows()) - iconPath = "/images/task_bar_icon_windows.png"; - else - iconPath = "/images/task_bar_icon_linux.png"; - - stage.getIcons().add(new Image(getClass().getResourceAsStream(iconPath))); + stage.getIcons().add(ImageUtil.getApplicationIconImage()); // make the UI visible stage.show(); diff --git a/desktop/src/main/java/bisq/desktop/util/ImageUtil.java b/desktop/src/main/java/bisq/desktop/util/ImageUtil.java index 45114e26418..948dee32094 100644 --- a/desktop/src/main/java/bisq/desktop/util/ImageUtil.java +++ b/desktop/src/main/java/bisq/desktop/util/ImageUtil.java @@ -19,6 +19,8 @@ import bisq.core.locale.Country; +import bisq.common.util.Utilities; + import javafx.scene.image.Image; import javafx.scene.image.ImageView; @@ -40,6 +42,18 @@ public static ImageView getImageViewById(String id) { return imageView; } + public static Image getApplicationIconImage () { + String iconPath; + if (Utilities.isOSX()) + iconPath = ImageUtil.isRetina() ? "/images/window_icon@2x.png" : "/images/window_icon.png"; + else if (Utilities.isWindows()) + iconPath = "/images/task_bar_icon_windows.png"; + else + iconPath = "/images/task_bar_icon_linux.png"; + + return getImageByUrl(iconPath); + } + private static Image getImageByUrl(String url) { return new Image(ImageUtil.class.getResourceAsStream(url)); }