feat(window):优化窗口重绘逻辑与主题更新

- 重构窗口重绘逻辑,区分全窗口重载与局部刷新
- 添加窗口内容清除与UI重新初始化流程
- 改进背景图片存在时的选择按钮背景色处理
- 更新语言配置文件中的时间戳与主题颜色选择器文本-修复窗口重绘时的残留背景问题
This commit is contained in:
tzdwindows 7
2025-10-05 18:49:49 +08:00
parent 000ab3488b
commit f24e78ab95
3 changed files with 30 additions and 4 deletions

View File

@@ -1,3 +1,3 @@
#Current Loaded Language #Current Loaded Language
#Sun Oct 05 16:06:50 CST 2025 #Sun Oct 05 18:45:33 CST 2025
loadedLanguage=system\:zh_CN loadedLanguage=system\:zh_CN

View File

@@ -186,6 +186,8 @@ settings.1.scrollPane=\u5DF2\u52A0\u8F7D\u63D2\u4EF6\u5217\u8868
settings.2.color=\u754C\u9762\u4E3B\u9898\u989C\u8272\uFF1A settings.2.color=\u754C\u9762\u4E3B\u9898\u989C\u8272\uFF1A
settings.2.colorBtn=\u9009\u62E9\u989C\u8272 settings.2.colorBtn=\u9009\u62E9\u989C\u8272
settings.2.colorBtn.color=\u9009\u62E9\u4E3B\u9898\u989C\u8272 settings.2.colorBtn.color=\u9009\u62E9\u4E3B\u9898\u989C\u8272
settings.2.colorBtn.cancel=\u53D6\u6D88
settings.2.colorBtn.apply=\u5E94\u7528
settings.2.font=\u754C\u9762\u5B57\u4F53\uFF1A settings.2.font=\u754C\u9762\u5B57\u4F53\uFF1A
settings.2.fontBtn=\u9009\u62E9\u5B57\u4F53 settings.2.fontBtn=\u9009\u62E9\u5B57\u4F53
settings.2.showConfirmDialog=\u9009\u62E9\u5B57\u4F53 settings.2.showConfirmDialog=\u9009\u62E9\u5B57\u4F53

View File

@@ -157,8 +157,17 @@ public class MainWindow extends JFrame {
this.cachedBackgroundSize = null; this.cachedBackgroundSize = null;
// 重新绘制窗口 // 重新绘制窗口
//if (AxisInnovatorsBox.getMain().isWindow()) if (AxisInnovatorsBox.getMain().isWindow()) {
// AxisInnovatorsBox.getMain().reloadAllWindow(); AxisInnovatorsBox.getMain().reloadAllWindow();
}
else {
getContentPane().removeAll();
revalidate();
repaint();
initUI();
updateTheme();
revalidate();
}
} }
/** /**
@@ -168,7 +177,15 @@ public class MainWindow extends JFrame {
this.backgroundImage = null; this.backgroundImage = null;
this.cachedBlurredBackground = null; this.cachedBlurredBackground = null;
this.cachedBackgroundSize = null; this.cachedBackgroundSize = null;
// 这是段重复的石山代码我不想改了,作用用py想都知道是更新窗口渲染
// 别问我为什么不用AxisInnovatorsBox.getMain().reloadAllWindow();
// 因为AxisInnovatorsBox.getMain().reloadAllWindow();会广播到所有窗口
getContentPane().removeAll();
repaint(); repaint();
initUI();
updateTheme();
revalidate();
} }
/** /**
@@ -872,7 +889,14 @@ public class MainWindow extends JFrame {
boolean selected = Objects.equals(currentCategoryId, category.getId().toString()); boolean selected = Objects.equals(currentCategoryId, category.getId().toString());
if (selected) { if (selected) {
button.setOpaque(true); button.setOpaque(true);
/**
* Java我草泥马你马死了
*/
if (backgroundImage == null) {
button.setBackground(SELECT_FILL); button.setBackground(SELECT_FILL);
} else {
button.setBackground(new Color(0, 120, 215, 255));
}
} else { } else {
button.setOpaque(false); button.setOpaque(false);
// 为避免残留,仍设置透明背景(透明颜色) // 为避免残留,仍设置透明背景(透明颜色)