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

📄 kingframe1.java

📁 学生信息管理系统
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                            ss = con.createStatement();
                            strsql = "delete from kk where id = '" +
                                     shanchuname +
                                     "'";
                            gengai();
                            ss.close();
                            JOptionPane.showMessageDialog(JF, "删除用户成功", "消息",
                                    JOptionPane.CANCEL_OPTION);
                            jTextField5.setText("");
                            jTextField4.setText("");
                            jPasswordField3.setText("");
                        } catch (SQLException ex) {
                            ex.printStackTrace();
                        }
                    } else {
                        JOptionPane.showMessageDialog(JF, "您删除的帐号不存在", "错误",
                                JOptionPane.ERROR_MESSAGE);
                        jTextField5.setText("");
                        jTextField4.setText("");
                        jPasswordField3.setText("");
                        result.close();
                        ss.close();
                    }
                } catch (SQLException ex) {
                    ex.printStackTrace();
                }
            }
        } else {
            JOptionPane.showMessageDialog(JF, "您不是超级管理员,不具有本权限", "错误",
                                          JOptionPane.ERROR_MESSAGE);
            jTextField5.setText("");
            jTextField4.setText("");
            jPasswordField3.setText("");
        }
    }

    //记事本功能(完成)
    public void jMenuItem11_actionPerformed(ActionEvent e) {
        if (kingFrame1obj) {
            JNotepad applet = JNotepad.newJNotepad();
            applet.setSize(800, 500);
            applet.setLocation(200, 200);
            applet.setVisible(true);
            applet.pack();
        } else {
            mm();
        }
    }

    //添加学生信息(完成)
    public void jMenuItem12_actionPerformed(ActionEvent e) {
        if (kingFrame1obj) {
            cardLayout1.show(contentPane, "jPanel8");
        } else {
            mm();
        }
    }

    //添加学生信息中的退出(完成)
    public void jButton16_actionPerformed(ActionEvent e) {
        cardLayout1.show(contentPane, "jPanel2");
    }

    //添加学生信息中的重置(完成)
    public void jButton17_actionPerformed(ActionEvent e) {
        jTextField6.setText("");
        jTextField7.setText("");
        jTextField8.setText("");
        jTextField9.setText("");
        jTextField10.setText("");
        jTextField11.setText("");
    }

    //添加中的确定按钮(完成)
    public void jButton15_actionPerformed(ActionEvent e) {
        String name = jTextField6.getText();
        String banji = jTextField7.getText();
        if (name.equals("") || banji.equals("") ||
            jTextField8.getText().equals("") ||
            jTextField9.getText().equals("") ||
            jTextField10.getText().equals("") ||
            jTextField11.getText().equals("")) {
            JOptionPane.showMessageDialog(JF, "您输入的信息不齐全,如果没有成绩用0分代替", "消息",
                                          JOptionPane.ERROR_MESSAGE);
        } else {
            float c = Float.parseFloat(jTextField8.getText());
            float html = Float.parseFloat(jTextField9.getText());
            float sql = Float.parseFloat(jTextField10.getText());
            float java = Float.parseFloat(jTextField11.getText());
            //判断分数是否在0-100之间
            if (c > 100 || c < 0) {
                JOptionPane.showMessageDialog(JF, "您输入的C语言成绩错误", "消息",
                                              JOptionPane.ERROR_MESSAGE);
                jTextField8.setText("");
            } else if (html > 100 || html < 0) {
                JOptionPane.showMessageDialog(JF, "您输入的html语言成绩错误", "消息",
                                              JOptionPane.ERROR_MESSAGE);
                jTextField9.setText("");
            } else if (sql > 100 || sql < 0) {
                JOptionPane.showMessageDialog(JF, "您输入的sql语言成绩错误", "消息",
                                              JOptionPane.ERROR_MESSAGE);
                jTextField10.setText("");
            } else if (java > 100 || java < 0) {
                JOptionPane.showMessageDialog(JF, "您输入的java语言成绩错误", "消息",
                                              JOptionPane.ERROR_MESSAGE);
                jTextField11.setText("");
            } else {
                //查询用户是否已经存在
                try {
                    ss = con.createStatement();
                } catch (SQLException ex1) {
                    ex1.printStackTrace();
                }
                strsql = "select * from xuesheng where name =" +
                         "'" + name + "'";
                select();
                try {
                    if (result.next()) {
                        JOptionPane.showMessageDialog(JF, "您输入的帐号已经存在", "错误",
                                JOptionPane.ERROR_MESSAGE);
                        jTextField3.setText("");
                        jPasswordField2.setText("");
                        result.close();
                        ss.close();
                    } else {
                        result.close();
                        ss.close();
                        ss = con.createStatement();
                        strsql = "insert into xuesheng values ('" + name +
                                 "','" +
                                 banji + "'," + c + "," + html + "," + sql +
                                 "," +
                                 java + ")";
                        gengai();
                        ss.close();
                        JOptionPane.showMessageDialog(JF, "添加成功", "消息",
                                JOptionPane.CANCEL_OPTION);
                        jTextField6.setText("");
                        jTextField7.setText("");
                        jTextField8.setText("");
                        jTextField9.setText("");
                        jTextField10.setText("");
                        jTextField11.setText("");
                    }
                } catch (SQLException ex) {
                    ex.printStackTrace();
                }
            }
        }
    }

    //修改密码面板!(完成)
    public void jMenuItem13_actionPerformed(ActionEvent e) {
        cardLayout1.show(contentPane, "jPanel9");
    }

    //修改密码中的取消(完成)
    public void jButton19_actionPerformed(ActionEvent e) {
        cardLayout1.show(contentPane, "jPanel2");
    }

    //修改密码中的重置(完成)
    public void jButton18_actionPerformed(ActionEvent e) {
        jTextField12.setText("");
        jPasswordField4.setText("");
        jPasswordField5.setText("");
        jPasswordField6.setText("");
    }

    //修改密码中的确定(完成)
    public void jButton20_actionPerformed(ActionEvent e) {
        String strzh = jTextField12.getText();
        String mima1 = jPasswordField4.getText();
        String xinmima1 = jPasswordField5.getText();
        String xinmima2 = jPasswordField6.getText();
        if (strzh.equals("")) {
            JOptionPane.showMessageDialog(JF, "帐号不能为空", "消息",
                                          JOptionPane.ERROR_MESSAGE);
            jTextField12.setText("");
        } else if (mima1.equals("")) {
            JOptionPane.showMessageDialog(JF, "原始密码不能为空", "消息",
                                          JOptionPane.ERROR_MESSAGE);
            jPasswordField4.setText("");
        } else if (xinmima1.equals("")) {
            JOptionPane.showMessageDialog(JF, "新密码不能为空", "消息",
                                          JOptionPane.ERROR_MESSAGE);
            jPasswordField5.setText("");
        } else if (xinmima2.equals("")) {
            JOptionPane.showMessageDialog(JF, "确认密码不能为空", "消息",
                                          JOptionPane.ERROR_MESSAGE);
            jPasswordField6.setText("");
        } else if (strzh.equals("eagle520")) {
            JOptionPane.showMessageDialog(JF, "超级管理员密码不可修改", "消息",
                                          JOptionPane.ERROR_MESSAGE);
        } else if (xinmima1.equals(xinmima2)) {
            //查询数据库
            try {
                ss = con.createStatement();
                strsql = "select * from kk where id =" +
                         "'" + strzh + "'";
                select();
                if (result.next()) {
                    if (mima1.equals(result.getObject(2))) {
                        result.close();
                        ss.close();
                        ss = con.createStatement();
                        strsql = "update kk set password = '" + xinmima1 +
                                 "' where id = '" + strzh + "'";
                        gengai();
                        ss.close();
                        JOptionPane.showMessageDialog(JF, "修改成功",
                                "消息",
                                JOptionPane.CLOSED_OPTION);
                        jTextField12.setText("");
                        jPasswordField4.setText("");
                        jPasswordField5.setText("");
                        jPasswordField6.setText("");

                    } else {
                        JOptionPane.showMessageDialog(JF, "您输入的密码错误",
                                "错误",
                                JOptionPane.ERROR_MESSAGE);
                        jPasswordField4.setText("");
                        result.close();
                        ss.close();
                    }
                } else {
                    JOptionPane.showMessageDialog(JF, "您输入的帐号不存在", "错误",
                                                  JOptionPane.ERROR_MESSAGE);
                    jTextField1.setText("");
                    jPasswordField1.setText("");
                    result.close();
                    ss.close();
                }
            } catch (SQLException ex) {
                ex.printStackTrace();
            }
        } else {
            JOptionPane.showMessageDialog(JF, "您输入的两次密码不相同", "消息",
                                          JOptionPane.ERROR_MESSAGE);
            jPasswordField5.setText("");
            jPasswordField6.setText("");
        }
    }
}


class kingFrame1_jButton20_actionAdapter implements ActionListener {
    private kingFrame1 adaptee;
    kingFrame1_jButton20_actionAdapter(kingFrame1 adaptee) {
        this.adaptee = adaptee;
    }

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


class kingFrame1_jButton18_actionAdapter implements ActionListener {
    private kingFrame1 adaptee;
    kingFrame1_jButton18_actionAdapter(kingFrame1 adaptee) {
        this.adaptee = adaptee;
    }

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


class kingFrame1_jButton19_actionAdapter implements ActionListener {
    private kingFrame1 adaptee;
    kingFrame1_jButton19_actionAdapter(kingFrame1 adaptee) {
        this.adaptee = adaptee;
    }

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


class kingFrame1_jMenuItem13_actionAdapter implements ActionListener {
    private kingFrame1 adaptee;
    kingFrame1_jMenuItem13_actionAdapter(kingFrame1 adaptee) {
        this.adaptee = adaptee;
    }

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


class kingFrame1_jMenuItem3_actionAdapter implements ActionListener {
    private kingFrame1 adaptee;
    kingFrame1_jMenuItem3_actionAdapter(kingFrame1 adaptee) {
        this.adaptee = adaptee;
    }

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


class kingFrame1_jButton15_actionAdapter implements ActionListener {
    private kingFrame1 adaptee;
    kingFrame1_jButton15_actionAdapter(kingFrame1 adaptee) {
        this.adaptee = adaptee;
    }

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


class kingFrame1_jButton17_actionAdapter implements ActionListener {
    private kingFrame1 adaptee;
    kingFrame1_jButton17_actionAdapter(kingFrame1 adaptee) {
        this.adaptee = adaptee;
    }

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


⌨️ 快捷键说明

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