⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 registerframe.java~41~

📁 本系统图书馆管理系统
💻 JAVA~41~
📖 第 1 页 / 共 2 页
字号:
        jLabel2.setForeground(UIManager.getColor(
                "CheckBoxMenuItem.selectionBackground"));
        jLabel2.setBorder(BorderFactory.createRaisedBevelBorder());
        jLabel2.setText("          会      员      注      册");
        jLabel2.setBounds(new Rectangle(39, 36, 214, 45));
    }

    JLabel jLabel1 = new JLabel();
    JLabel jLabel2 = new JLabel();
    JLabel jLabel3 = new JLabel();
    JTextField jTextField1 = new JTextField();
    JLabel jLabel4 = new JLabel();
    JLabel jLabel5 = new JLabel();
    JLabel jLabel6 = new JLabel();
    JPasswordField jPasswordField1 = new JPasswordField();
    JPasswordField jPasswordField2 = new JPasswordField();
    JComboBox jComboBox1 = new JComboBox(nn);
    JLabel jLabel7 = new JLabel();
    JLabel jLabel8 = new JLabel();
    JLabel jLabel9 = new JLabel();
    JLabel jLabel10 = new JLabel();
    JTextField jTextField2 = new JTextField();
    JComboBox jComboBox2 = new JComboBox(bb);
    JComboBox jComboBox3 = new JComboBox(aa);
    JTextField jTextField3 = new JTextField();
    JLabel jLabel11 = new JLabel();
    JTextField jTextField4 = new JTextField();
    JLabel jLabel12 = new JLabel();
    JLabel jLabel13 = new JLabel();
    JTextField jTextField5 = new JTextField();
    JLabel jLabel14 = new JLabel();
    JTextField jTextField6 = new JTextField();
    JButton jButton1 = new JButton();
    JButton jButton2 = new JButton();
    public void jButton1_actionPerformed(ActionEvent e) {
        jTextField1.setText("");
        jTextField2.setText("");
        jTextField3.setText("");
        jTextField4.setText("");
        jTextField5.setText("");
        jTextField6.setText("");
        jPasswordField1.setText("");
        jPasswordField2.setText("");
    }

    public void jButton2_actionPerformed(ActionEvent e) {

        //////////////////////////////////////////////////////////////
        //the input password must be  the same
        if (!String.valueOf(jPasswordField1.getPassword()).equals(String.valueOf(jPasswordField2.getPassword() ) ) )//( jPasswordField2.getPassword())) {
        {   JOptionPane.showOptionDialog(null, "passwords are not the same!",
                                         "WARNING",
                                         JOptionPane.OK_CANCEL_OPTION,
                                         JOptionPane.WARNING_MESSAGE, null, null, null);
            return ;
        }

        //////////////////////////////////////////////////////////////
        //the input ID must be digit with the length  of 8
        if(jTextField1.getText().length()!=8)
        {
            JOptionPane.showOptionDialog(null, "the length of ID is wrong!",
                                         "WARNING",
                                         JOptionPane.OK_CANCEL_OPTION,
                                         JOptionPane.WARNING_MESSAGE, null, null, null);
            return ;
        }
        //////////////////////////////////////////////////////////////
        //the input ID must be digit with the length  of 8
        char[] array=jTextField1.getText().toCharArray();
        for(int i=0;i<8;i++)
            if(array[i]<48||array[i]>57)
            {
                JOptionPane.showOptionDialog(null, "ID is not digit !",
                                          "WARNING",
                                          JOptionPane.OK_CANCEL_OPTION,
                                          JOptionPane.WARNING_MESSAGE, null, null, null);
                return ;
            }
        ///////////////////////////////////////////////////////
        //check the @ in the E_mail
        /*char[] arrayEmail=jTextField6.getText().toCharArray();
        int i;
        for(i=0;i<arrayEmail.length;i++)
            if(arrayEmail[i]=='@')
                break;
        if(i==arrayEmail.length)
        {
            JOptionPane.showOptionDialog(null, "E_mail is wrong!",
                                          "WARNING",
                                          JOptionPane.OK_CANCEL_OPTION,
                                          JOptionPane.WARNING_MESSAGE, null, null, null);
                return ;
        }*/

    //////////////////////////////////////////////////////////
    //  check IC
    //////////////////////////////////////////////////////////////
    //the input ID must be digit with the length  of 8
    if(jTextField3.getText().length()!=18)
    {
        JOptionPane.showOptionDialog(null, "the length of IdentityNumber is wrong!",
                                     "WARNING",
                                     JOptionPane.OK_CANCEL_OPTION,
                                     JOptionPane.WARNING_MESSAGE, null, null, null);
        return ;
    }
    //////////////////////////////////////////////////////////////
    //the input ID must be digit with the length  of 8
    char[] array1=jTextField3.getText().toCharArray();
    for(int i=0;i<18;i++)
        if(array1[i]<48||array1[i]>57)
        {
            JOptionPane.showOptionDialog(null, "IdentityNumber is not digit !",
                                      "WARNING",
                                      JOptionPane.OK_CANCEL_OPTION,
                                      JOptionPane.WARNING_MESSAGE, null, null, null);
            return ;
        }

        User user = new User();
        //System.out.println("aaaa");
        user.setUserID(jTextField1.getText());
        user.setUserPWD(String.valueOf(jPasswordField1.getPassword()));
        //System.out.println(String.valueOf(jComboBox1.getName()));//////////////
        user.setUserType(String.valueOf(jComboBox1.getSelectedItem()));
        //System.out.println("bbbb");
        user.setUserName(jTextField2.getText());
        user.setUserSex(String.valueOf(jComboBox2.getSelectedItem()));
        //System.out.println("hhh");
        user.setUserDept(String.valueOf(jComboBox3.getSelectedItem()));
        user.setUserIC(jTextField3.getText());
        //System.out.println("rrr");
        user.setUserAdd(jTextField4.getText());
        user.setUserTel(jTextField5.getText());
        user.setUserEmail(jTextField6.getText());

        if(user.getUserType().equals("本科生"))
            user.setSumOfBook(4);
        else if(user.getUserType().equals("研究生"))
            user.setSumOfBook(6);
        else if(user.getUserType().equals("教授"))
            user.setSumOfBook(8);

        if(DatabaseQuery.userListQuery(user))
            DatabaseOperate.insertUserList(user);
    }
}


class RegisterFrame_jButton2_actionAdapter implements ActionListener {
    private RegisterFrame adaptee;
    RegisterFrame_jButton2_actionAdapter(RegisterFrame adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.jButton2_actionPerformed(e);
    }
}


class RegisterFrame_jButton1_actionAdapter implements ActionListener {
    private RegisterFrame adaptee;
    RegisterFrame_jButton1_actionAdapter(RegisterFrame adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.jButton1_actionPerformed(e);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -