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

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