/*
|
* 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
|
}
|