whycrzg
2021-03-11 a2bbdc9501439ec20cadd8f1efbee1a0ac8cf3d4
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
/*
 * Created by JFormDesigner on Tue Feb 23 16:22:53 CST 2021
 */
 
package org.pzone.crypto;
 
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
 
/**
 * @author abc
 */
public class MainUI extends JFrame {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    public static void main(String[] args) {
 
        EventQueue.invokeLater(new Runnable() {
 
            @Override
            public void run() {
                MainUI mainui = new MainUI();
                mainui.setVisible(true);
 
            }
        });
    }
    
    public MainUI() {
        initComponents();
    }
 
    private void okButtonActionPerformed(ActionEvent e) {
        char[] password = textFieldPWD.getPassword();
        if (String.valueOf(password).equals("666666")) {
            RegistCode registCode = new RegistCode();
            this.dispose();
            registCode.setVisible(true);
        }else{
            JOptionPane.showMessageDialog(null, "密码不正确!");
        }
    }
 
    private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
        panel1 = new JPanel();
        contentPanel = new JPanel();
        panel4 = new JPanel();
        textFieldPWD = new JPasswordField();
        panel3 = new JPanel();
        okButton = new JButton();
        panel2 = new JPanel();
 
        //======== this ========
        setMinimumSize(new Dimension(500, 330));
        Container contentPane = getContentPane();
        contentPane.setLayout(new GridLayout(3, 0));
 
        //======== panel1 ========
        {
            panel1.setLayout(new CardLayout());
        }
        contentPane.add(panel1);
 
        //======== contentPanel ========
        {
            contentPanel.setLayout(new GridLayout(2, 0));
 
            //======== panel4 ========
            {
                panel4.setLayout(null);
 
                //---- textFieldPWD ----
                textFieldPWD.setToolTipText("\u8bf7\u8f93\u5165\u5bc6\u7801");
                textFieldPWD.setFont(new Font("\u5b8b\u4f53", Font.PLAIN, 20));
                panel4.add(textFieldPWD);
                textFieldPWD.setBounds(135, 5, 249, 51);
 
                { // compute preferred size
                    Dimension preferredSize = new Dimension();
                    for(int i = 0; i < panel4.getComponentCount(); i++) {
                        Rectangle bounds = panel4.getComponent(i).getBounds();
                        preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                        preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                    }
                    Insets insets = panel4.getInsets();
                    preferredSize.width += insets.right;
                    preferredSize.height += insets.bottom;
                    panel4.setMinimumSize(preferredSize);
                    panel4.setPreferredSize(preferredSize);
                }
            }
            contentPanel.add(panel4);
 
            //======== panel3 ========
            {
                panel3.setLayout(null);
 
                //---- okButton ----
                okButton.setText("OK");
                okButton.addActionListener(e -> okButtonActionPerformed(e));
                panel3.add(okButton);
                okButton.setBounds(175, 15, 170, 40);
 
                { // compute preferred size
                    Dimension preferredSize = new Dimension();
                    for(int i = 0; i < panel3.getComponentCount(); i++) {
                        Rectangle bounds = panel3.getComponent(i).getBounds();
                        preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                        preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                    }
                    Insets insets = panel3.getInsets();
                    preferredSize.width += insets.right;
                    preferredSize.height += insets.bottom;
                    panel3.setMinimumSize(preferredSize);
                    panel3.setPreferredSize(preferredSize);
                }
            }
            contentPanel.add(panel3);
        }
        contentPane.add(contentPanel);
 
        //======== panel2 ========
        {
            panel2.setLayout(new CardLayout());
        }
        contentPane.add(panel2);
        pack();
        setLocationRelativeTo(getOwner());
        // JFormDesigner - End of component initialization  //GEN-END:initComponents
    }
 
    // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
    private JPanel panel1;
    private JPanel contentPanel;
    private JPanel panel4;
    private JPasswordField textFieldPWD;
    private JPanel panel3;
    private JButton okButton;
    private JPanel panel2;
    // JFormDesigner - End of variables declaration  //GEN-END:variables
}