diff --git a/build.gradle b/build.gradle index fa39a2a..4fe9223 100644 --- a/build.gradle +++ b/build.gradle @@ -59,6 +59,13 @@ jlink { launcher { name = 'RoomIt' } + jpackage { + applicationName = "RoomIt" + installerType = "exe" + appVersion = project.version + icon = "icon/logo16x16.ico" + description = "开源屏幕画笔工具" + } } jlinkZip { diff --git a/icon/logo16x16.ico b/icon/logo16x16.ico new file mode 100644 index 0000000..be66578 Binary files /dev/null and b/icon/logo16x16.ico differ diff --git a/src/main/java/org/rococy/roomit/MainWindow.java b/src/main/java/org/rococy/roomit/MainWindow.java index 9a75ce7..1fc1b5c 100644 --- a/src/main/java/org/rococy/roomit/MainWindow.java +++ b/src/main/java/org/rococy/roomit/MainWindow.java @@ -4,6 +4,7 @@ import javafx.application.Application; import javafx.application.Platform; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; +import javafx.scene.image.Image; import javafx.scene.paint.Paint; import javafx.stage.Stage; import javafx.stage.StageStyle; @@ -64,6 +65,8 @@ public class MainWindow extends Application { stage.setResizable(false); // 设置窗口透明 stage.initStyle(StageStyle.TRANSPARENT); + // 设置图标 + stage.getIcons().add(new Image(ResourceUtils.getResourceAsStream(GlobalConsts.LOGO_PATH))); // 将窗口显示出来 stage.show(); } catch ( diff --git a/src/main/java/org/rococy/roomit/TrayWindow.java b/src/main/java/org/rococy/roomit/TrayWindow.java index 743a049..4b4f542 100644 --- a/src/main/java/org/rococy/roomit/TrayWindow.java +++ b/src/main/java/org/rococy/roomit/TrayWindow.java @@ -3,6 +3,7 @@ package org.rococy.roomit; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; +import javafx.scene.image.Image; import javafx.scene.paint.Paint; import javafx.stage.Screen; import javafx.stage.Stage; @@ -36,6 +37,8 @@ public class TrayWindow extends Application { stage.setAlwaysOnTop(true); // 取消任务栏 stage.initStyle(StageStyle.TRANSPARENT); + // 设置图标 + stage.getIcons().add(new Image(ResourceUtils.getResourceAsStream(GlobalConsts.LOGO_PATH))); // 当没有焦点时关闭 stage.focusedProperty().addListener((observable, oldValue, newValue) -> { diff --git a/src/main/java/org/rococy/roomit/constant/GlobalConsts.java b/src/main/java/org/rococy/roomit/constant/GlobalConsts.java index 146e584..5ce51a1 100644 --- a/src/main/java/org/rococy/roomit/constant/GlobalConsts.java +++ b/src/main/java/org/rococy/roomit/constant/GlobalConsts.java @@ -21,7 +21,7 @@ public class GlobalConsts { /** * logo图标路径 */ - public static final String LOGO_PATH = "img/logo24x24.png"; + public static final String LOGO_PATH = "img/logo32x32.png"; /** * 配置文件路径 diff --git a/src/main/resources/org/rococy/roomit/img/logo24x24.png b/src/main/resources/org/rococy/roomit/img/logo24x24.png deleted file mode 100644 index 7b7f15d..0000000 Binary files a/src/main/resources/org/rococy/roomit/img/logo24x24.png and /dev/null differ diff --git a/src/main/resources/org/rococy/roomit/img/logo32x32.png b/src/main/resources/org/rococy/roomit/img/logo32x32.png new file mode 100644 index 0000000..630813f Binary files /dev/null and b/src/main/resources/org/rococy/roomit/img/logo32x32.png differ