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

📄 kingframe1.java

📁 学生信息管理系统
💻 JAVA
📖 第 1 页 / 共 5 页
字号:



import javax.swing.*;

import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import java.util.*;
import javax.swing.table.*;
import java.awt.Rectangle;
import java.awt.Font;
import java.awt.BorderLayout;

public class kingFrame1 extends JFrame {
    kingFrame1 JF;
    JPanel contentPane;
    Connection con;
    String strsql;
    Statement ss;
    ResultSet result;
    ArrayList jtobjsz = new ArrayList();
    int num1 = 0;
    boolean kingFrame1obj = false;
    boolean kks = false;
    boolean kkb = false;
    JPanel jPanel2 = new JPanel();
    CardLayout cardLayout1 = new CardLayout();
    JMenuBar jMenuBar1 = new JMenuBar();
    JMenu jMenu1 = new JMenu();//菜单"使用"
    JMenuItem jMenuItem1 = new JMenuItem();//下拉菜单"查询学生信息"
    JMenuItem jMenuItem2 = new JMenuItem();//下拉菜单"更改学生信息"
    JMenu jMenu2 = new JMenu();//菜单"用户管理"
    JMenuItem jMenuItem4 = new JMenuItem();//下拉菜单"添加用户"
    JMenuItem jMenuItem5 = new JMenuItem();//下拉菜单"删除用户"
    JMenuItem jMenuItem6 = new JMenuItem();//下拉菜单"更换用户"
    JMenu jMenu3 = new JMenu();//菜单"帮助"
    JMenuItem jMenuItem7 = new JMenuItem();//下拉菜单"版本信息"
    JMenuItem jMenuItem8 = new JMenuItem();//下拉菜单"帮助文档"
    JMenu jMenu4 = new JMenu();//菜单"退出"
    JMenuItem jMenuItem9 = new JMenuItem();//下拉菜单"退出"
    JPanel jPanel1 = new JPanel();
    JLabel jLabel1 = new JLabel();//标签"用户登录界面"
    JButton jButton1 = new JButton();//按钮"重置"
    JButton jButton2 = new JButton();//按钮"提交"
    JTextField jTextField1 = new JTextField();//登录文本框
    JPasswordField jPasswordField1 = new JPasswordField();//登录文本框
    JLabel jLabel2 = new JLabel();//标签"密码"
    JLabel jLabel3 = new JLabel();//标签"用户名"
    JLabel jLabel4 = new JLabel();//标签"欢迎使用学生信息管理系统"
    JLabel jLabel5 = new JLabel();
    JMenuItem jMenuItem10 = new JMenuItem();//下拉菜单"登录"
    JPanel jPanel3 = new JPanel();//布局管理器
    String[] strobj3 = {"姓名", "班级", "C语言", "Html", "SQL","Java"};
    JPanel jPanel4 = new JPanel();
    JComboBox jComboBox1 = new JComboBox();
    JComboBox jComboBox2;
    JLabel jLabel6 = new JLabel();//标签"请选择更改类型"
    JTextField jTextField2 = new JTextField();
    JLabel jLabel7 = new JLabel();//标签"请输入更改内容"
    JButton jButton3 = new JButton();//按钮"提交"
    JButton jButton4 = new JButton();//按钮"重置"
    JButton jButton5 = new JButton();//"退出"
    JLabel jLabel8 = new JLabel();
    JLabel jLabel9 = new JLabel();
    JComboBox jComboBox3 = new JComboBox();
    JPanel jPanel5 = new JPanel();
    JLabel jLabel10 = new JLabel();
    JComboBox jComboBox4;
    JButton jButton6 = new JButton();
    JButton jButton7 = new JButton();
    JButton jButton8 = new JButton();
    JLabel jLabel11 = new JLabel();
    JLabel jLabel12 = new JLabel();
    JPanel jPanel6 = new JPanel();
    JLabel jLabel13 = new JLabel();
    JLabel jLabel14 = new JLabel();
    JTextField jTextField3 = new JTextField();
    JLabel jLabel15 = new JLabel();
    JButton jButton9 = new JButton();
    JButton jButton10 = new JButton();
    JButton jButton11 = new JButton();
    JPasswordField jPasswordField2 = new JPasswordField();
    JPanel jPanel7 = new JPanel();
    JLabel jLabel16 = new JLabel();
    JLabel jLabel17 = new JLabel();
    JTextField jTextField4 = new JTextField();
    JLabel jLabel18 = new JLabel();
    JPasswordField jPasswordField3 = new JPasswordField();
    JTextField jTextField5 = new JTextField();
    JLabel jLabel19 = new JLabel();
    JButton jButton12 = new JButton();
    JButton jButton13 = new JButton();
    JButton jButton14 = new JButton();
    JMenuItem jMenuItem11 = new JMenuItem();
    JMenuItem jMenuItem12 = new JMenuItem();
    JPanel jPanel8 = new JPanel();
    JLabel jLabel20 = new JLabel();
    JLabel jLabel21 = new JLabel();
    JTextField jTextField6 = new JTextField();
    JLabel jLabel22 = new JLabel();
    JTextField jTextField7 = new JTextField();
    JLabel jLabel23 = new JLabel();
    JTextField jTextField8 = new JTextField();
    JTextField jTextField9 = new JTextField();
    JTextField jTextField10 = new JTextField();
    JTextField jTextField11 = new JTextField();
    JButton jButton15 = new JButton();
    JButton jButton16 = new JButton();
    JButton jButton17 = new JButton();
    JLabel jLabel24 = new JLabel();
    JLabel jLabel25 = new JLabel();
    JLabel jLabel26 = new JLabel();
    JLabel jLabel27 = new JLabel();
    JMenuItem jMenuItem3 = new JMenuItem();
    JMenuItem jMenuItem13 = new JMenuItem();
    JPanel jPanel9 = new JPanel();
    JLabel jLabel28 = new JLabel();
    JLabel jLabel29 = new JLabel();
    JLabel jLabel30 = new JLabel();
    JLabel jLabel31 = new JLabel();
    JLabel jLabel32 = new JLabel();
    JTextField jTextField12 = new JTextField();
    JPasswordField jPasswordField4 = new JPasswordField();
    JPasswordField jPasswordField5 = new JPasswordField();
    JPasswordField jPasswordField6 = new JPasswordField();
    JButton jButton18 = new JButton();
    JButton jButton19 = new JButton();
    JButton jButton20 = new JButton();
    BorderLayout borderLayout1 = new BorderLayout();
    JScrollPane jScrollPane1 = new JScrollPane();
    JScrollPane jScrollPane2 = new JScrollPane();
    JScrollPane jScrollPane3 = new JScrollPane();
    public kingFrame1() {
        try {
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            JF = this;
            zz();
            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

    //链接数据库的方法
    void zz() {
        try {
            Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
            String str ="jdbc:microsoft:SQLServer://localhost:1433;databasename=enigma;";
            con = DriverManager.getConnection(str, "sa", "sa");
        } catch (ClassNotFoundException ex) {
            ex.printStackTrace();
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        contentPane = (JPanel) getContentPane();
        contentPane.setLayout(cardLayout1);
        this.setJMenuBar(jMenuBar1);
        setSize(new Dimension(400, 300));
        jComboBox1.addItem("请选择");
        jComboBox1.addItem("学生姓名");
        jComboBox1.addItem("学生班级");
        jComboBox1.addItem("学生成绩");
        jComboBox3.addItem("请选择科目");
        jComboBox3.addItem("C");
        jComboBox3.addItem("Html");
        jComboBox3.addItem("Sqlserver");
        jComboBox3.addItem("Java");
        jPanel2.setLayout(null);
        jMenu1.setText("使用");
        jMenuItem1.setText("查询学生信息");
        jMenuItem1.addActionListener(new kingFrame1_jMenuItem1_actionAdapter(this));
        jMenuItem2.setText("更改学生信息");
        jMenuItem2.addActionListener(new kingFrame1_jMenuItem2_actionAdapter(this));
        jMenu2.setText("用户管理");
        jMenuItem4.setText("添加用户");
        jMenuItem4.addActionListener(new kingFrame1_jMenuItem4_actionAdapter(this));
        jMenuItem5.setText("删除用户");
        jMenuItem5.addActionListener(new kingFrame1_jMenuItem5_actionAdapter(this));
        jMenuItem6.setText("更换用户");
        jMenuItem6.addActionListener(new kingFrame1_jMenuItem6_actionAdapter(this));
        jMenu3.setText("帮助");
        jMenuItem7.setText("版本信息");
        jMenuItem7.addActionListener(new kingFrame1_jMenuItem7_actionAdapter(this));
        jMenuItem8.setText("帮助文档");
        jMenuItem8.addActionListener(new kingFrame1_jMenuItem8_actionAdapter(this));
        jMenu4.setText("退出");
        jMenuItem9.setText("退出");
        jMenuItem9.addActionListener(new kingFrame1_jMenuItem9_actionAdapter(this));
        jLabel1.setFont(new java.awt.Font("宋体", Font.PLAIN, 25));
        jLabel1.setText("用户登陆界面");
        jLabel1.setBounds(new Rectangle(125, 34, 150, 30));
        jButton1.setBounds(new Rectangle(224, 230, 79, 34));
        jButton1.setText("重置");
        jButton1.addActionListener(new kingFrame1_jButton1_actionAdapter(this));
        jButton2.setBounds(new Rectangle(89, 230, 79, 34));
        jButton2.setText("提交");
        jButton2.addActionListener(new kingFrame1_jButton2_actionAdapter(this));
        jTextField1.setBounds(new Rectangle(151, 94, 131, 20));
        jPasswordField1.setBounds(new Rectangle(151, 150, 131, 20));
        jLabel2.setFont(new java.awt.Font("宋体", Font.PLAIN, 16));
        jLabel2.setText("密 码");
        jLabel2.setBounds(new Rectangle(87, 153, 48, 19));
        jLabel3.setFont(new java.awt.Font("宋体", Font.PLAIN, 16));
        jLabel3.setText("用户名");
        jLabel3.setBounds(new Rectangle(83, 98, 48, 19));
        jPanel1.setLayout(null);
        jLabel4.setFont(new java.awt.Font("宋体", Font.PLAIN, 25));
        jLabel4.setText("欢迎使用学生管理系统");
        jLabel4.setBounds(new Rectangle(69, 46, 261, 47));
        jMenuItem10.setText("登陆");
        jMenuItem10.addActionListener(new kingFrame1_jMenuItem10_actionAdapter(this));
        jPanel3.setLayout(borderLayout1);
        jPanel4.setLayout(null);
        jComboBox1.setBounds(new Rectangle(148, 21, 134, 22));
        jComboBox1.addActionListener(new kingFrame1_jComboBox1_actionAdapter(this));
        jLabel6.setText("请选择更改类型");
        jLabel6.setBounds(new Rectangle(51, 21, 87, 24));
        jTextField2.setBounds(new Rectangle(153, 157, 133, 29));
        jLabel7.setText("请输入更改内容");
        jLabel7.setBounds(new Rectangle(48, 158, 90, 30));
        jButton3.setBounds(new Rectangle(54, 214, 75, 34));
        jButton3.setText("提交");
        jButton3.addActionListener(new kingFrame1_jButton3_actionAdapter(this));
        jButton4.setBounds(new Rectangle(174, 212, 75, 38));
        jButton4.setText("重置");
        jButton4.addActionListener(new kingFrame1_jButton4_actionAdapter(this));
        jButton5.setBounds(new Rectangle(294, 212, 75, 36));
        jButton5.setText("退出");
        jButton5.addActionListener(new kingFrame1_jButton5_actionAdapter(this));
        jLabel8.setText("请选择更改的学生");
        jLabel8.setBounds(new Rectangle(39, 64, 99, 28));
        jLabel9.setText("请选择成绩科目");
        jLabel9.setBounds(new Rectangle(48, 113, 86, 31));
        jComboBox3.setBounds(new Rectangle(150, 116, 137, 23));
        jPanel5.setLayout(null);
        jLabel10.setText("请选择您要删除信息的学生");
        jLabel10.setBounds(new Rectangle(23, 110, 145, 44));

        jButton6.setBounds(new Rectangle(55, 218, 70, 29));
        jButton6.setText("提交");
        jButton6.addActionListener(new kingFrame1_jButton6_actionAdapter(this));
        jButton7.setBounds(new Rectangle(162, 217, 70, 29));
        jButton7.setText("重置");
        jButton7.addActionListener(new kingFrame1_jButton7_actionAdapter(this));
        jButton8.setBounds(new Rectangle(268, 216, 70, 29));
        jButton8.setText("退出");
        jButton8.addActionListener(new kingFrame1_jButton8_actionAdapter(this));
        jLabel11.setFont(new java.awt.Font("宋体", Font.PLAIN, 15));
        jLabel11.setText("此项为不可恢复操作!请用户慎重选择");
        jLabel11.setBounds(new Rectangle(67, 60, 256, 31));
        jLabel12.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        jLabel12.setText("友情提示");
        jLabel12.setBounds(new Rectangle(153, 16, 85, 29));
        jPanel6.setLayout(null);
        jLabel13.setFont(new java.awt.Font("宋体", Font.PLAIN, 18));
        jLabel13.setText("请输入帐户");
        jLabel13.setBounds(new Rectangle(55, 97, 94, 15));
        jLabel14.setFont(new java.awt.Font("宋体", Font.PLAIN, 18));
        jLabel14.setText("请输入密码");
        jLabel14.setBounds(new Rectangle(57, 151, 92, 15));
        jTextField3.setBounds(new Rectangle(182, 89, 140, 24));
        jLabel15.setFont(new java.awt.Font("宋体", Font.PLAIN, 25));
        jLabel15.setText("新用户注册");
        jLabel15.setBounds(new Rectangle(123, 25, 131, 37));
        jButton9.setBounds(new Rectangle(54, 210, 69, 36));
        jButton9.setText("提交");
        jButton9.addActionListener(new kingFrame1_jButton9_actionAdapter(this));
        jButton10.setBounds(new Rectangle(163, 210, 69, 36));
        jButton10.setText("重置");
        jButton10.addActionListener(new kingFrame1_jButton10_actionAdapter(this));
        jButton11.setBounds(new Rectangle(272, 210, 69, 36));
        jButton11.setText("退出");
        jButton11.addActionListener(new kingFrame1_jButton11_actionAdapter(this));
        jPasswordField2.setBounds(new Rectangle(182, 147, 140, 24));
        jPanel7.setLayout(null);
        jLabel16.setFont(new java.awt.Font("宋体", Font.PLAIN, 26));
        jLabel16.setText("删除用户");
        jLabel16.setBounds(new Rectangle(135, 15, 110, 47));
        jLabel17.setText("请输入要删除的用户名");
        jLabel17.setBounds(new Rectangle(14, 73, 130, 35));
        jTextField4.setBounds(new Rectangle(165, 82, 192, 26));
        jLabel18.setText("请输入您的帐号");
        jLabel18.setBounds(new Rectangle(26, 122, 98, 27));
        jPasswordField3.setBounds(new Rectangle(165, 173, 192, 26));
        jTextField5.setBounds(new Rectangle(165, 127, 192, 26));
        jLabel19.setText("请输入您的密码");
        jLabel19.setBounds(new Rectangle(24, 174, 99, 21));
        jButton12.setBounds(new Rectangle(36, 239, 86, 27));
        jButton12.setText("确定");
        jButton12.addActionListener(new kingFrame1_jButton12_actionAdapter(this));
        jButton13.setBounds(new Rectangle(265, 238, 86, 27));
        jButton13.setText("退出");
        jButton13.addActionListener(new kingFrame1_jButton13_actionAdapter(this));
        jButton14.setBounds(new Rectangle(150, 239, 86, 27));
        jButton14.setText("重置");
        jButton14.addActionListener(new kingFrame1_jButton14_actionAdapter(this));
        jMenuItem11.setText("记事本");
        jMenuItem11.addActionListener(new kingFrame1_jMenuItem11_actionAdapter(this));
        jMenuItem12.setText("添加学生信息");
        jMenuItem12.addActionListener(new kingFrame1_jMenuItem12_actionAdapter(this));
        jLabel20.setFont(new java.awt.Font("宋体", Font.PLAIN, 25));
        jLabel20.setText("添加学生信息");
        jLabel20.setBounds(new Rectangle(112, 26, 152, 30));
        jPanel8.setLayout(null);
        jLabel21.setText("请输入学生姓名");
        jLabel21.setBounds(new Rectangle(24, 78, 88, 22));
        jTextField6.setBounds(new Rectangle(127, 82, 80, 20));
        jLabel22.setText("请输入学生班级");
        jLabel22.setBounds(new Rectangle(215, 87, 85, 15));
        jTextField7.setBounds(new Rectangle(308, 82, 80, 20));
        jLabel23.setText("请输入学生各科成绩");
        jLabel23.setBounds(new Rectangle(22, 119, 116, 15));
        jTextField8.setBounds(new Rectangle(98, 145, 83, 20));
        jTextField9.setBounds(new Rectangle(252, 145, 83, 20));
        jTextField10.setBounds(new Rectangle(95, 187, 83, 20));
        jTextField11.setBounds(new Rectangle(254, 190, 83, 20));
        jButton15.setBounds(new Rectangle(38, 254, 87, 23));
        jButton15.setText("提交");
        jButton15.addActionListener(new kingFrame1_jButton15_actionAdapter(this));
        jButton16.setBounds(new Rectangle(265, 254, 87, 23));
        jButton16.setText("退出");
        jButton16.addActionListener(new kingFrame1_jButton16_actionAdapter(this));
        jButton17.setBounds(new Rectangle(152, 254, 87, 23));
        jButton17.setText("重置");
        jButton17.addActionListener(new kingFrame1_jButton17_actionAdapter(this));
        jLabel24.setText("C语言");
        jLabel24.setBounds(new Rectangle(47, 145, 35, 15));

⌨️ 快捷键说明

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