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

📄 king.java~7~

📁 学生信息管理系统~~~~~~~~~~~~~~~~~~~~~~~~~
💻 JAVA~7~
📖 第 1 页 / 共 2 页
字号:
package enigma;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.table.*;
import java.awt.Rectangle;

public class kingFrame1 extends JFrame {
    kingFrame1 JF;
    JPanel contentPane;
    Connection con;
    String strsql;
    Statement ss;
    ResultSet result;
    boolean kingFrame1obj = 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();
    JMenuItem jMenuItem3 = 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"};
    Object [][] aa = { {"", "", "", "", "",""},
                    {"", "", "", "","",""}};
    JScrollPane jScrollPane1 = new JScrollPane();
    JTable jTable1 = new JTable(aa,strobj3);
    JTableHeader jtobj = jTable1.getTableHeader() ;
    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));
        setTitle("Frame Title");
        jPanel2.setLayout(null);
        jMenu1.setText("使用");
        jMenuItem1.setText("查询学生信息");
        jMenuItem1.addActionListener(new kingFrame1_jMenuItem1_actionAdapter(this));
        jMenuItem2.setText("更改数据");
        jMenuItem2.addActionListener(new kingFrame1_jMenuItem2_actionAdapter(this));
        jMenuItem3.setText("删除数据");
        jMenuItem3.addActionListener(new kingFrame1_jMenuItem3_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));
        jLabel5.setFont(new java.awt.Font("宋体", Font.PLAIN, 15));
        jLabel5.setText("子俊实验室研发");
        jLabel5.setBounds(new Rectangle(134, 151, 108, 42));
        jMenuItem10.setText("登陆");
        jMenuItem10.addActionListener(new kingFrame1_jMenuItem10_actionAdapter(this));
        jPanel3.setLayout(null);
        jtobj.setBounds(new Rectangle(1, 9, 498, 29));
        jScrollPane1.setBounds(new Rectangle(1, 28, 383, 266));
        jTable1.setBounds(new Rectangle(3, 37, 381, 254));
        contentPane.add(jPanel2, "jPanel2");
        jPanel2.add(jLabel4);
        jPanel2.add(jLabel5);
        contentPane.add(jPanel1, "jPanel1");
        jPanel1.add(jLabel1);
        jPanel1.add(jLabel3);
        jPanel1.add(jButton2);
        jPanel1.add(jButton1);
        jPanel1.add(jLabel2);
        jPanel1.add(jPasswordField1);
        jPanel1.add(jTextField1);
        jMenuBar1.add(jMenu1);
        jMenuBar1.add(jMenu2);
        jMenuBar1.add(jMenu3);
        jMenuBar1.add(jMenu4);
        jMenu1.add(jMenuItem10);
        jMenu1.add(jMenuItem1);
        jMenu1.add(jMenuItem2);
        jMenu1.add(jMenuItem3);
        jMenu2.add(jMenuItem4);
        jMenu2.add(jMenuItem5);
        jMenu2.add(jMenuItem6);
        jMenu3.add(jMenuItem7);
        jMenu3.add(jMenuItem8);
        jMenu4.add(jMenuItem9);
        contentPane.add(jPanel3, "jPanel3");
        jPanel3.add(this.jtobj);
        jPanel3.add(jTable1);
        jPanel3.add(jtobj);
        jtobj.add(jScrollPane1);
    }
    //退出
    public void jMenuItem9_actionPerformed(ActionEvent actionEvent) {
        System.exit(0);
        try {
            con.close();
        } catch (SQLException ex) {
        }
    }

    //帮助中的版本信息
    public void jMenuItem7_actionPerformed(ActionEvent actionEvent) {
        JOptionPane.showMessageDialog(JF, "  子俊实验室学生管理系统  1.0版", "消息",
                                      JOptionPane.CLOSED_OPTION);
    }

    //登陆
    public void jMenuItem10_actionPerformed(ActionEvent e) {
        cardLayout1.show(contentPane, "jPanel1");
    }
    //查询信息
    public void jMenuItem1_actionPerformed(ActionEvent e) {
        if (kingFrame1obj) {
            strsql = "select * from xuesheng";
            select();
            try {
                ResultSetMetaData md = result.getMetaData();
                int cnt = md.getColumnCount();
                int temp = 0;
                Object calls [][]  = null;
                while (result.next()) {
                    for (int i = 1; i <= cnt; i++) {
                        calls[temp][i] = result.getObject(i);
                    }
                    temp = temp + 1;
                    System.out.println("");
                }
                result.close();
                ss.close();
                cardLayout1.show(contentPane, "jPanel3");
            } catch (SQLException ex) {
                ex.printStackTrace();
            }
        } else {
            mm();
        }
    }
    //更改信息
    public void jMenuItem2_actionPerformed(ActionEvent e) {
        if (kingFrame1obj) {
            JOptionPane.showMessageDialog(JF, "更改信息", "消息",
                                          JOptionPane.CLOSED_OPTION);
        } else {
            mm();
        }
    }

⌨️ 快捷键说明

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