diff --git a/src/main/java/com/axis/innovators/box/gui/ComponentFactory.java b/src/main/java/com/axis/innovators/box/gui/ComponentFactory.java new file mode 100644 index 0000000..c41952c --- /dev/null +++ b/src/main/java/com/axis/innovators/box/gui/ComponentFactory.java @@ -0,0 +1,57 @@ +package com.axis.innovators.box.gui; + +import javax.swing.*; +import java.awt.*; + +public class ComponentFactory { + /** + * 创建带样式的文本组件 + * @param text 显示文本 + * @param color 文本颜色 + * @param fontSize 字体大小(单位:pt) + * @param size 组件尺寸(null时使用自动布局) + * @return 配置完成的文本组件 + */ + public static Component createTextComponent(String text, Color color, + int fontSize, Dimension size) { + return createTextComponent(text, color, fontSize, null, size); + } + + /** + * 重载方法支持背景色配置 + * @param bgColor 背景颜色(null时为透明) + */ + public static Component createTextComponent(String text, Color color, + int fontSize, Color bgColor, + Dimension size) { + JLabel label = new JLabel(text) { + // 抗锯齿渲染 + @Override + protected void paintComponent(Graphics g) { + Graphics2D g2 = (Graphics2D) g; + g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB); + super.paintComponent(g2); + } + }; + + // 基础样式配置 + label.setForeground(color); + label.setFont(new Font("微软雅黑", Font.PLAIN, fontSize)); + + // 背景色处理 + if (bgColor != null) { + label.setOpaque(true); + label.setBackground(bgColor); + } + + // 尺寸设置 + if (size != null) { + label.setPreferredSize(size); + label.setMinimumSize(size); + label.setMaximumSize(size); + } + + return label; + } +} diff --git a/src/main/resources/icons/decompile.png b/src/main/resources/icons/decompile.png new file mode 100644 index 0000000..3931479 Binary files /dev/null and b/src/main/resources/icons/decompile.png differ diff --git a/src/main/resources/icons/exit.png b/src/main/resources/icons/exit.png new file mode 100644 index 0000000..c9b6e6c Binary files /dev/null and b/src/main/resources/icons/exit.png differ diff --git a/src/main/resources/icons/home.png b/src/main/resources/icons/home.png new file mode 100644 index 0000000..d8a9401 Binary files /dev/null and b/src/main/resources/icons/home.png differ