feat(ui): 添加全局图标配置并优化弹窗图标显示
将图标加载逻辑提取到 GlobalConfig 中统一管理,并在登录失败弹窗及 Cookie更新完成弹窗中设置应用图标。同时修复了部分弹窗文本描述不一致的问题。
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
package com.fantaibao.config;
|
||||
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.stage.Stage;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
public class GlobalConfig {
|
||||
/**
|
||||
* 基础网络地址
|
||||
@@ -46,4 +53,23 @@ public class GlobalConfig {
|
||||
*/
|
||||
public static String dyLoginPage;
|
||||
|
||||
|
||||
|
||||
public static final Image icon16;
|
||||
public static final Image icon32;
|
||||
|
||||
static {
|
||||
try {
|
||||
icon16 = new Image(new FileInputStream(ResourceUtils.getFile("classpath:icon16.png")));
|
||||
icon32 = new Image(new FileInputStream(ResourceUtils.getFile("classpath:icon32.png")));
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void addIcon(Stage stage) {
|
||||
stage.getIcons().add(GlobalConfig.icon16);
|
||||
stage.getIcons().add(GlobalConfig.icon32);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user