826220679@qq.com
17 小时以前 d655e19ad18eea30f3627fc1c499ae9fe4200d92
src/set/Sets.java
@@ -110,6 +110,8 @@
        mainPanel.add(scrollPane, BorderLayout.CENTER);
        
        add(mainPanel, BorderLayout.CENTER);
        setupEventHandlers();
    }
    
    private JPanel createSettingsPanel() {
@@ -193,6 +195,9 @@
        JPanel manualBoundaryDrawingPanel = createManualBoundaryDrawingPanel();
        manualBoundaryDrawingModeLabel = (JLabel) manualBoundaryDrawingPanel.getClientProperty("valueLabel");
        // 修改密码设置项
        JPanel changePasswordPanel = createChangePasswordPanel();
        JPanel feedbackPanel = createFeedbackPanel();
        
        // APP版本
@@ -214,6 +219,7 @@
        addSettingItem(panel, boundaryLengthPanel, true);
        addSettingItem(panel, measurementModePanel, true);
        addSettingItem(panel, manualBoundaryDrawingPanel, true);
        addSettingItem(panel, changePasswordPanel, true);
        addSettingItem(panel, feedbackPanel, true);
        addSettingItem(panel, appVersionPanel, true);
        addSettingItem(panel, logoutPanel, false);  // 最后一项不加分割线
@@ -899,7 +905,7 @@
        }
        updateDisplay();
        // 加载并应用上次保存的视图中心坐标
        loadViewCenterFromProperties();
        // loadViewCenterFromProperties(); // 移除此调用,避免打开设置页面时重置地图视图
    }
    
    /**
@@ -1062,43 +1068,34 @@
        return trimmed;
    }
    
    private void addActionListenerUnique(JButton button, ActionListener listener) {
        if (button == null) return;
        for (ActionListener al : button.getActionListeners()) {
            button.removeActionListener(al);
        }
        button.addActionListener(listener);
    }
    private void setupEventHandlers() {
        // 割草机编号编辑按钮事件
        if (mowerIdEditBtn != null) {
            mowerIdEditBtn.addActionListener(e -> editMowerId());
        }
        addActionListenerUnique(mowerIdEditBtn, e -> editMowerId());
        // 割草机长宽编辑按钮事件
        if (mowerSizeEditBtn != null) {
            mowerSizeEditBtn.addActionListener(e -> editMowerSize());
        }
        addActionListenerUnique(mowerSizeEditBtn, e -> editMowerSize());
        // 割草安全距离编辑按钮事件
        if (mowingSafetyDistanceEditBtn != null) {
            mowingSafetyDistanceEditBtn.addActionListener(e -> editMowingSafetyDistance());
        }
        addActionListenerUnique(mowingSafetyDistanceEditBtn, e -> editMowingSafetyDistance());
        if (baseStationIdEditBtn != null) {
            baseStationIdEditBtn.addActionListener(e -> editBaseStationId());
        }
        addActionListenerUnique(baseStationIdEditBtn, e -> editBaseStationId());
        
        // 检查更新按钮事件
        if (checkUpdateBtn != null) {
            checkUpdateBtn.addActionListener(e -> checkForUpdates());
        }
        addActionListenerUnique(checkUpdateBtn, e -> checkForUpdates());
        if (handheldEditBtn != null) {
            handheldEditBtn.addActionListener(e -> editHandheldMarkerId());
        }
        addActionListenerUnique(handheldEditBtn, e -> editHandheldMarkerId());
        if (feedbackButton != null) {
            feedbackButton.addActionListener(e -> showFeedbackDialog());
        }
        addActionListenerUnique(feedbackButton, e -> showFeedbackDialog());
        if (idleTrailEditBtn != null) {
            idleTrailEditBtn.addActionListener(e -> editIdleTrailDuration());
        }
        addActionListenerUnique(idleTrailEditBtn, e -> editIdleTrailDuration());
    }
    
    private void editMowerId() {
@@ -1804,7 +1801,6 @@
    @Override
    public void setVisible(boolean visible) {
        if (visible) {
            setupEventHandlers();
            loadData(); // 每次显示时重新加载数据
        }
        super.setVisible(visible);
@@ -1860,4 +1856,57 @@
        
        return panel;
    }
    /**
     * 创建修改密码设置面板
     */
    private JPanel createChangePasswordPanel() {
        JPanel panel = new JPanel(new GridBagLayout());
        panel.setOpaque(false);
        panel.setAlignmentX(Component.LEFT_ALIGNMENT);
        panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, ROW_HEIGHT));
        panel.setPreferredSize(new Dimension(Integer.MAX_VALUE, ROW_HEIGHT));
        panel.setMinimumSize(new Dimension(0, ROW_HEIGHT));
        panel.setBorder(BorderFactory.createEmptyBorder(ITEM_PADDING, ITEM_PADDING, ITEM_PADDING, ITEM_PADDING));
        GridBagConstraints gbc = new GridBagConstraints();
        JLabel titleLabel = new JLabel("修改密码");
        titleLabel.setFont(new Font("微软雅黑", Font.BOLD, 14));
        titleLabel.setForeground(Color.BLACK);
        titleLabel.setHorizontalAlignment(SwingConstants.RIGHT);
        gbc.gridx = 0;
        gbc.gridy = 0;
        gbc.weightx = 0;
        gbc.anchor = GridBagConstraints.EAST;
        gbc.insets = new Insets(0, 0, 0, 12);
        panel.add(titleLabel, gbc);
        JLabel valueLabel = new JLabel("******");
        valueLabel.setFont(new Font("微软雅黑", Font.PLAIN, 14));
        valueLabel.setForeground(Color.DARK_GRAY);
        gbc = new GridBagConstraints();
        gbc.gridx = 1;
        gbc.gridy = 0;
        gbc.weightx = 1.0;
        gbc.anchor = GridBagConstraints.EAST;
        panel.add(valueLabel, gbc);
        JButton editBtn = createEditButton();
        editBtn.addActionListener(e -> {
            SwingUtilities.invokeLater(() -> {
                xiugaimima dialog = new xiugaimima((Frame) SwingUtilities.getWindowAncestor(this));
                dialog.setVisible(true);
            });
        });
        gbc = new GridBagConstraints();
        gbc.gridx = 2;
        gbc.gridy = 0;
        gbc.weightx = 0;
        gbc.anchor = GridBagConstraints.EAST;
        panel.add(editBtn, gbc);
        return panel;
    }
}