-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor BisqApp - move icon load into ImageUtil
- Loading branch information
Showing
2 changed files
with
15 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/[email protected]" : "/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(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/[email protected]" : "/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)); | ||
} | ||
|