| | |
| | | public LegendDialog(Component parent, Color ignoredThemeColor) { |
| | | super(parent != null ? (JFrame) SwingUtilities.getWindowAncestor(parent) : null, |
| | | "图例", true); |
| | | // 使用统一宽度,高度缩减为一半 |
| | | initializeDialog(UIConfig.DIALOG_WIDTH, UIConfig.DIALOG_HEIGHT / 2); |
| | | int adjustedWidth = (int) Math.round(UIConfig.DIALOG_WIDTH * 0.8); |
| | | int adjustedHeight = (int) Math.round(UIConfig.DIALOG_HEIGHT * 0.4); |
| | | initializeDialog(adjustedWidth, adjustedHeight); |
| | | initializeLegendContent(); |
| | | if (parent == null) { |
| | | setLocationRelativeTo(null); // 居中显示 |
| | |
| | | mainPanel.setBackground(Color.WHITE); |
| | | mainPanel.setBorder(BorderFactory.createEmptyBorder(15, 15, 10, 15)); |
| | | |
| | | // 标题 - 修改为"图例" |
| | | JLabel titleLabel = new JLabel("图例", JLabel.CENTER); |
| | | titleLabel.setFont(new Font("微软雅黑", Font.BOLD, 14)); |
| | | titleLabel.setForeground(new Color(60, 60, 60)); |
| | | titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); |
| | | mainPanel.add(titleLabel, BorderLayout.NORTH); |
| | | |
| | | // 图例内容面板 - 直接添加,不使用滚动条 |
| | | JPanel contentPanel = new JPanel(); |
| | | contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS)); |