张世豪
昨天 43bd281a47eeac52e649ef79ea25c0dd4d61af7d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
package xitongshezhi;
 
import javax.swing.*;
import javax.swing.border.EmptyBorder;
 
import chushihua.Chushihua;
 
import java.awt.*;
import java.io.*;
import java.util.Properties;
 
@SuppressWarnings("serial")
public class mimaguanli extends JDialog {
    // 屏幕尺寸常量 - 适配7寸竖屏
    private static final int SCREEN_WIDTH = 600;
    private static final int SCREEN_HEIGHT = 1024;
    
    private Chushihua config;
    private Properties props;
    private String configFile = "config.properties";
 
    // 颜色定义
    private static final Color BACKGROUND_COLOR = new Color(15, 28, 48);
    private static final Color CARD_COLOR = new Color(26, 43, 68);
    private static final Color PRIMARY_COLOR = new Color(52, 152, 219);
    private static final Color SECONDARY_COLOR = new Color(46, 204, 113);
    private static final Color TEXT_COLOR = new Color(224, 224, 224);
    private static final Color TEXT_LIGHT_COLOR = new Color(160, 200, 255);
    private static final Color FIELD_BACKGROUND = new Color(240, 240, 240);
 
    // 组件声明
    private JPanel mainPanel;
    private JLabel titleLabel;
    private JButton backButton;
 
    // 管理员密码组件
    private JPanel adminPanel;
    private JPasswordField currentAdminField;
    private JPasswordField newAdminField;
    private JPasswordField confirmAdminField;
    private JButton saveAdminButton;
 
    // 取卡密码组件
    private JPanel pickupPanel;
    private JPasswordField currentPickupField;
    private JPasswordField newPickupField;
    private JPasswordField confirmPickupField;
    private JButton savePickupButton;
 
    // 显示/隐藏密码按钮
    private JButton toggleCurrentAdmin, toggleNewAdmin, toggleConfirmAdmin;
    private JButton toggleCurrentPickup, toggleNewPickup, toggleConfirmPickup;
 
 
    public mimaguanli(JFrame parent, Chushihua config) {
        super(parent, "密码管理", true);
        this.config = config;
        this.props = new Properties();
        loadConfig();
 
        initializeUI();
        setupEventListeners();
    }
 
    private void initializeUI() {
        setSize(SCREEN_WIDTH, SCREEN_HEIGHT);
        setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
        setLocationRelativeTo(null);
        setResizable(false);
 
        // 设置深色主题
        try {
            UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
        } catch (Exception e) {
            e.printStackTrace();
        }
 
        // 创建主面板
        mainPanel = new JPanel();
        mainPanel.setLayout(new BorderLayout());
        mainPanel.setBackground(BACKGROUND_COLOR);
        mainPanel.setOpaque(true);
        mainPanel.setBorder(new EmptyBorder(12, 12, 12, 12));
 
        // 添加各个区域
        mainPanel.add(createHeaderPanel(), BorderLayout.NORTH);
        mainPanel.add(createContentPanel(), BorderLayout.CENTER);
 
        getContentPane().add(mainPanel);
    }
 
    private JPanel createHeaderPanel() {
        JPanel headerPanel = new JPanel(new BorderLayout());
        headerPanel.setOpaque(false);
        headerPanel.setBorder(new EmptyBorder(0, 0, 12, 0));
 
        // 标题
        titleLabel = new JLabel("密码管理");
        titleLabel.setFont(new Font("Microsoft YaHei", Font.BOLD, 22));
        titleLabel.setForeground(TEXT_COLOR);
 
        // 返回按钮
        backButton = new JButton("关闭");
        backButton.setFont(new Font("Microsoft YaHei", Font.PLAIN, 14));
        backButton.setBackground(PRIMARY_COLOR);
        backButton.setForeground(Color.WHITE);
        backButton.setOpaque(true);
        backButton.setFocusPainted(false);
        backButton.setBorder(BorderFactory.createEmptyBorder(8, 16, 8, 16));
        
        // 返回按钮悬停效果
        backButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                backButton.setBackground(brighterColor(PRIMARY_COLOR));
            }
            
            public void mouseExited(java.awt.event.MouseEvent evt) {
                backButton.setBackground(PRIMARY_COLOR);
            }
        });
 
        JPanel titlePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
        titlePanel.setOpaque(false);
        titlePanel.add(titleLabel);
 
        JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
        buttonPanel.setOpaque(false);
        buttonPanel.add(backButton);
 
        headerPanel.add(titlePanel, BorderLayout.WEST);
        headerPanel.add(buttonPanel, BorderLayout.EAST);
 
        return headerPanel;
    }
 
    private JPanel createContentPanel() {
        JPanel contentPanel = new JPanel();
        contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
        contentPanel.setBackground(BACKGROUND_COLOR);
        contentPanel.setOpaque(true);
 
        // 管理员密码面板
        adminPanel = createPasswordPanel(
                "管理员密码", 
                "设置系统管理登录密码",
                "current-admin",
                "new-admin", 
                "confirm-admin",
                "建议使用6位以上字母+数字组合",
                "保存管理员密码"
                );
 
        contentPanel.add(Box.createRigidArea(new Dimension(0, 20)));
        contentPanel.add(adminPanel);
        contentPanel.add(Box.createRigidArea(new Dimension(0, 25)));
 
        // 取卡密码面板
        pickupPanel = createPasswordPanel(
                "取卡密码", 
                "设置首页取卡操作密码",
                "current-pickup",
                "new-pickup", 
                "confirm-pickup",
                "建议使用4-6位数字密码",
                "保存取卡密码"
                );
        contentPanel.add(pickupPanel);
        contentPanel.add(Box.createRigidArea(new Dimension(0, 20)));
 
        // 滚动面板
        JScrollPane scrollPane = new JScrollPane(contentPanel);
        scrollPane.setBorder(BorderFactory.createEmptyBorder());
        scrollPane.getViewport().setBackground(BACKGROUND_COLOR);
        scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
 
        // 自定义滚动条
        JScrollBar verticalScrollBar = scrollPane.getVerticalScrollBar();
        verticalScrollBar.setBackground(CARD_COLOR);
        verticalScrollBar.setForeground(PRIMARY_COLOR);
        verticalScrollBar.setUnitIncrement(20);
 
        JPanel container = new JPanel(new BorderLayout());
        container.setBackground(BACKGROUND_COLOR);
        container.setOpaque(true);
        container.add(scrollPane, BorderLayout.CENTER);
 
        return container;
    }
 
    private JPanel createPasswordPanel(String title, String description, 
            String currentId, String newId, String confirmId,
            String hint, String buttonText) {
        JPanel panel = new JPanel();
        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
        panel.setBackground(CARD_COLOR);
        panel.setBorder(BorderFactory.createCompoundBorder(
                BorderFactory.createLineBorder(new Color(52, 152, 219, 100), 1),
                BorderFactory.createEmptyBorder(20, 20, 20, 20)
                ));
        panel.setMaximumSize(new Dimension(SCREEN_WIDTH - 50, Integer.MAX_VALUE));
 
        // 标题区域
        JPanel titlePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
        titlePanel.setBackground(CARD_COLOR);
        titlePanel.setAlignmentX(Component.LEFT_ALIGNMENT);
 
        JLabel iconLabel = new JLabel();
        iconLabel.setPreferredSize(new Dimension(40, 40));
        iconLabel.setOpaque(true);
        iconLabel.setBackground(new Color(52, 152, 219, 255));
        iconLabel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
 
        JPanel textPanel = new JPanel();
        textPanel.setLayout(new BoxLayout(textPanel, BoxLayout.Y_AXIS));
        textPanel.setBackground(CARD_COLOR);
        textPanel.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0));
 
        JLabel titleLabel = new JLabel(title);
        titleLabel.setFont(new Font("Microsoft YaHei", Font.BOLD, 18));
        titleLabel.setForeground(TEXT_COLOR);
        titleLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
 
        JLabel descLabel = new JLabel(description);
        descLabel.setFont(new Font("Microsoft YaHei", Font.PLAIN, 13));
        descLabel.setForeground(TEXT_LIGHT_COLOR);
        descLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
 
        textPanel.add(titleLabel);
        textPanel.add(Box.createRigidArea(new Dimension(0, 4)));
        textPanel.add(descLabel);
 
        titlePanel.add(iconLabel);
        titlePanel.add(textPanel);
 
        // 表单区域
        JPanel formPanel = new JPanel();
        formPanel.setLayout(new BoxLayout(formPanel, BoxLayout.Y_AXIS));
        formPanel.setBackground(CARD_COLOR);
        formPanel.setBorder(BorderFactory.createEmptyBorder(20, 0, 0, 0));
        formPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
 
        // 当前密码
        JPanel currentPanel = createHorizontalPasswordField("当前密码", currentId);
        formPanel.add(currentPanel);
        formPanel.add(Box.createRigidArea(new Dimension(0, 18)));
 
        // 新密码
        JPanel newPanel = createHorizontalPasswordField("新密码", newId);
        formPanel.add(newPanel);
        formPanel.add(Box.createRigidArea(new Dimension(0, 18)));
 
        // 确认新密码
        JPanel confirmPanel = createHorizontalPasswordField("确认新密码", confirmId);
        formPanel.add(confirmPanel);
        formPanel.add(Box.createRigidArea(new Dimension(0, 15)));
 
        // 提示信息
        JLabel hintLabel = new JLabel(hint);
        hintLabel.setFont(new Font("Microsoft YaHei", Font.PLAIN, 12));
        hintLabel.setForeground(TEXT_LIGHT_COLOR);
        hintLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
        hintLabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 15, 0));
 
        // 保存按钮容器
        JPanel buttonContainer = new JPanel();
        buttonContainer.setLayout(new BoxLayout(buttonContainer, BoxLayout.X_AXIS));
        buttonContainer.setBackground(CARD_COLOR);
        buttonContainer.setAlignmentX(Component.CENTER_ALIGNMENT);
 
        // 保存按钮
        JButton saveButton = new JButton(buttonText);
        saveButton.setFont(new Font("Microsoft YaHei", Font.BOLD, 15));
        saveButton.setBackground(SECONDARY_COLOR);
        saveButton.setForeground(Color.WHITE);
        saveButton.setBorder(BorderFactory.createCompoundBorder(
                BorderFactory.createLineBorder(new Color(40, 180, 100), 1),
                BorderFactory.createEmptyBorder(12, 25, 12, 25)
                ));
        saveButton.setFocusPainted(false);
        saveButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
        saveButton.setAlignmentX(Component.CENTER_ALIGNMENT);
 
        // 保存按钮悬停效果
        saveButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                saveButton.setBackground(brighterColor(SECONDARY_COLOR));
            }
            
            public void mouseExited(java.awt.event.MouseEvent evt) {
                saveButton.setBackground(SECONDARY_COLOR);
            }
        });
 
        // 根据面板类型设置按钮动作
        if (title.equals("管理员密码")) {
            saveAdminButton = saveButton;
        } else {
            savePickupButton = saveButton;
        }
 
        buttonContainer.add(Box.createHorizontalGlue());
        buttonContainer.add(saveButton);
        buttonContainer.add(Box.createHorizontalGlue());
 
        formPanel.add(hintLabel);
        formPanel.add(Box.createVerticalGlue());
        formPanel.add(buttonContainer);
 
        panel.add(titlePanel);
        panel.add(formPanel);
 
        return panel;
    }
 
    private JPanel createHorizontalPasswordField(String labelText, String fieldId) {
        JPanel panel = new JPanel(new BorderLayout());
        panel.setBackground(CARD_COLOR);
        panel.setMaximumSize(new Dimension(SCREEN_WIDTH - 100, 50));
 
        // 标签
        JLabel label = new JLabel(labelText);
        label.setFont(new Font("Microsoft YaHei", Font.BOLD, 14));
        label.setForeground(TEXT_COLOR);
        label.setPreferredSize(new Dimension(100, 30));
 
        // 输入框面板
        JPanel fieldPanel = new JPanel(new BorderLayout());
        fieldPanel.setBackground(FIELD_BACKGROUND);
        fieldPanel.setBorder(BorderFactory.createLineBorder(new Color(200, 200, 200), 1));
        fieldPanel.setPreferredSize(new Dimension(280, 42));
 
        JPasswordField passwordField = new JPasswordField();
        passwordField.setBackground(FIELD_BACKGROUND);
        passwordField.setForeground(Color.BLACK);
        passwordField.setBorder(BorderFactory.createEmptyBorder(10, 12, 10, 40));
        passwordField.setEchoChar('•');
        passwordField.setFont(new Font("Microsoft YaHei", Font.PLAIN, 14));
        passwordField.setOpaque(true);
 
        JButton toggleButton = new JButton("👁");
        toggleButton.setFont(new Font("Segoe UI Emoji", Font.PLAIN, 14));
        toggleButton.setBackground(FIELD_BACKGROUND);
        toggleButton.setForeground(Color.GRAY);
        toggleButton.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
        toggleButton.setFocusPainted(false);
        toggleButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
        toggleButton.setOpaque(true);
 
        // 根据字段ID设置对应的组件引用
        switch (fieldId) {
        case "current-admin":
            currentAdminField = passwordField;
            toggleCurrentAdmin = toggleButton;
            break;
        case "new-admin":
            newAdminField = passwordField;
            toggleNewAdmin = toggleButton;
            break;
        case "confirm-admin":
            confirmAdminField = passwordField;
            toggleConfirmAdmin = toggleButton;
            break;
        case "current-pickup":
            currentPickupField = passwordField;
            toggleCurrentPickup = toggleButton;
            break;
        case "new-pickup":
            newPickupField = passwordField;
            toggleNewPickup = toggleButton;
            break;
        case "confirm-pickup":
            confirmPickupField = passwordField;
            toggleConfirmPickup = toggleButton;
            break;
        }
 
        fieldPanel.add(passwordField, BorderLayout.CENTER);
        fieldPanel.add(toggleButton, BorderLayout.EAST);
 
        // 创建水平布局容器
        JPanel horizontalPanel = new JPanel(new BorderLayout());
        horizontalPanel.setBackground(CARD_COLOR);
        horizontalPanel.setMaximumSize(new Dimension(SCREEN_WIDTH - 100, 50));
 
        horizontalPanel.add(label, BorderLayout.WEST);
        horizontalPanel.add(fieldPanel, BorderLayout.CENTER);
 
        // 添加间距
        horizontalPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
 
        return horizontalPanel;
    }
 
    private void setupEventListeners() {
        // 返回按钮
        backButton.addActionListener(e -> {
            dispose();
        });
 
        // 管理员密码保存按钮
        saveAdminButton.addActionListener(e -> {
            saveAdminPassword();
        });
 
        // 取卡密码保存按钮
        savePickupButton.addActionListener(e -> {
            savePickupPassword();
        });
 
        // 密码显示/隐藏按钮
        setupToggleButton(toggleCurrentAdmin, currentAdminField, "currentAdminVisible");
        setupToggleButton(toggleNewAdmin, newAdminField, "newAdminVisible");
        setupToggleButton(toggleConfirmAdmin, confirmAdminField, "confirmAdminVisible");
        setupToggleButton(toggleCurrentPickup, currentPickupField, "currentPickupVisible");
        setupToggleButton(toggleNewPickup, newPickupField, "newPickupVisible");
        setupToggleButton(toggleConfirmPickup, confirmPickupField, "confirmPickupVisible");
    }
 
    private void setupToggleButton(JButton button, JPasswordField field, String visibilityField) {
        button.addActionListener(e -> {
            try {
                java.lang.reflect.Field visibleField = mimaguanli.this.getClass().getDeclaredField(visibilityField);
                boolean isVisible = (boolean) visibleField.get(mimaguanli.this);
 
                if (isVisible) {
                    field.setEchoChar('•');
                    button.setText("👁");
                    button.setForeground(Color.GRAY);
                } else {
                    field.setEchoChar((char) 0);
                    button.setText("🔒");
                    button.setForeground(PRIMARY_COLOR);
                }
 
                visibleField.set(mimaguanli.this, !isVisible);
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        });
    }
 
    private void loadConfig() {
        try {
            File configFile = new File(this.configFile);
            if (!configFile.exists()) {
                // 如果配置文件不存在,创建默认配置
                createDefaultConfig();
            }
            props.load(new FileInputStream(this.configFile));
        } catch (IOException e) {
            JOptionPane.showMessageDialog(this, "配置文件加载失败: " + e.getMessage(), 
                    "错误", JOptionPane.ERROR_MESSAGE);
        }
    }
 
    private void createDefaultConfig() {
        try {
            props.setProperty("admin.password", "admin123");
            props.setProperty("fetch.card.password", "1234");
            props.store(new FileOutputStream(configFile), "Default Configuration");
        } catch (IOException e) {
            JOptionPane.showMessageDialog(this, "创建默认配置文件失败: " + e.getMessage(), 
                    "错误", JOptionPane.ERROR_MESSAGE);
        }
    }
 
    private void saveAdminPassword() {
        String currentPwd = new String(currentAdminField.getPassword());
        String newPwd = new String(newAdminField.getPassword());
        String confirmPwd = new String(confirmAdminField.getPassword());
 
        // 验证输入
        if (currentPwd.isEmpty() || newPwd.isEmpty() || confirmPwd.isEmpty()) {
            showMessageDialog("操作失败", "请填写所有密码字段", JOptionPane.WARNING_MESSAGE);
            return;
        }
 
        if (!newPwd.equals(confirmPwd)) {
            showMessageDialog("操作失败", "新密码和确认密码不一致", JOptionPane.WARNING_MESSAGE);
            return;
        }
 
        if (newPwd.length() < 3) {
            showMessageDialog("操作失败", "密码长度不能少于3位", JOptionPane.WARNING_MESSAGE);
            return;
        }
 
        // 验证当前密码 - 从Chushihua配置获取
        String actualCurrentPwd = config.getMachineConfig().getAdminPassword();
        if (!currentPwd.equals(actualCurrentPwd)) {
            showMessageDialog("操作失败", "当前密码不正确", JOptionPane.WARNING_MESSAGE);
            return;
        }
 
        // 保存到Chushihua配置
        config.getMachineConfig().setAdminPassword(newPwd);
        config.saveConfig();
 
        showMessageDialog("操作成功", "管理员密码已成功更新", JOptionPane.INFORMATION_MESSAGE);
 
        // 清空字段
        currentAdminField.setText("");
        newAdminField.setText("");
        confirmAdminField.setText("");
    }
 
    private void savePickupPassword() {
        String currentPwd = new String(currentPickupField.getPassword());
        String newPwd = new String(newPickupField.getPassword());
        String confirmPwd = new String(confirmPickupField.getPassword());
 
        // 验证输入
        if (currentPwd.isEmpty() || newPwd.isEmpty() || confirmPwd.isEmpty()) {
            showMessageDialog("操作失败", "请填写所有密码字段", JOptionPane.WARNING_MESSAGE);
            return;
        }
 
        if (!newPwd.equals(confirmPwd)) {
            showMessageDialog("操作失败", "新密码和确认密码不一致", JOptionPane.WARNING_MESSAGE);
            return;
        }
 
        if (newPwd.length() < 3) {
            showMessageDialog("操作失败", "取卡密码长度不能少于3位", JOptionPane.WARNING_MESSAGE);
            return;
        }
 
        // 验证当前密码 - 从Chushihua配置获取
        String actualCurrentPwd = config.getMachineConfig().getFetchCardPassword();
        if (!currentPwd.equals(actualCurrentPwd)) {
            showMessageDialog("操作失败", "当前密码不正确", JOptionPane.WARNING_MESSAGE);
            return;
        }
 
        // 保存到Chushihua配置
        config.getMachineConfig().setFetchCardPassword(newPwd);
        config.saveConfig();
 
        showMessageDialog("操作成功", "取卡密码已成功更新", JOptionPane.INFORMATION_MESSAGE);
 
        // 清空字段
        currentPickupField.setText("");
        newPickupField.setText("");
        confirmPickupField.setText("");
    }
 
    private void showMessageDialog(String title, String message, int messageType) {
        JOptionPane.showMessageDialog(this, message, title, messageType);
    }
 
    // 辅助方法:使颜色更亮
    private Color brighterColor(Color color) {
        int r = Math.min(255, color.getRed() + 30);
        int g = Math.min(255, color.getGreen() + 30);
        int b = Math.min(255, color.getBlue() + 30);
        return new Color(r, g, b);
    }
 
    // 静态方法:从其他页面调用
    public static void showPasswordManagementDialog(JFrame parent, Chushihua config) {
        SwingUtilities.invokeLater(() -> {
            mimaguanli dialog = new mimaguanli(parent, config);
            dialog.setVisible(true);
        });
    }
    
}