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

📄 superadd.java~30~

📁 java语言做的教务管理系统
💻 JAVA~30~
📖 第 1 页 / 共 2 页
字号:
package java_教务管理系统;

import java.awt.*;

import javax.swing.*;
import java.awt.Rectangle;
import javax.swing.table.JTableHeader;
import javax.swing.table.DefaultTableModel;
import java.awt.Font;
import javax.swing.BorderFactory;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseAdapter;
import java.util.Date;
import java.text.SimpleDateFormat;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2008</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class superadd extends JPanel {
    public superadd() {
        try {
            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        this.setLayout(null);
        tbsuper.setFont(new java.awt.Font("宋体", Font.PLAIN, 15));
        tbsuper.setBounds(new Rectangle(6, 55, 857, 176));
        tbsuper.addMouseListener(new superadd_tbsuper_mouseAdapter(this));
        jTableHeader1.setFont(new java.awt.Font("宋体", Font.PLAIN, 15));
        jTableHeader1.setBounds(new Rectangle(6, 22, 857, 32));
        jLabel1.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        jLabel1.setText("用户名:");
        jLabel1.setBounds(new Rectangle(142, 242, 82, 33));
        txtid.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        txtid.setBounds(new Rectangle(238, 242, 159, 28));
        jLabel2.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        jLabel2.setText("密码:");
        jLabel2.setBounds(new Rectangle(488, 238, 78, 30));
        txtpassword.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        txtpassword.setBounds(new Rectangle(572, 240, 211, 28));
        jLabel3.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        jLabel3.setText("用户类型:");
        jLabel3.setBounds(new Rectangle(125, 286, 109, 29));
        cbotype.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        cbotype.setBounds(new Rectangle(238, 282, 159, 28));
        jLabel4.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        jLabel4.setText("注销时间:");
        jLabel4.setBounds(new Rectangle(126, 323, 114, 30));
        txtLogoff.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        txtLogoff.setEditable(false);
        txtLogoff.setBounds(new Rectangle(238, 321, 226, 28));
        jLabel5.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        jLabel5.setText("备注:");
        jLabel5.setBounds(new Rectangle(165, 355, 106, 41));
        jLabel6.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        jLabel6.setText("状态:");
        jLabel6.setBounds(new Rectangle(495, 319, 83, 40));
        cboAppearance.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        cboAppearance.setEditable(true);
        cboAppearance.setBounds(new Rectangle(573, 318, 88, 28));
        jLabel7.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        jLabel7.setText("注册时间:");
        jLabel7.setBounds(new Rectangle(449, 281, 118, 26));
        txaRemarks.setFont(new java.awt.Font("Dialog", Font.PLAIN, 20));
        txaRemarks.setBounds(new Rectangle(238, 360, 545, 79));
        jButton1.setBounds(new Rectangle(699, 454, 113, 33));
        jButton1.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        jButton1.setText("退出管理");
        jButton2.setBounds(new Rectangle(562, 454, 113, 33));
        jButton2.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        jButton2.setText("修改用户");
        jButton2.addActionListener(new superadd_jButton2_actionAdapter(this));
        jButton3.setBounds(new Rectangle(420, 454, 113, 33));
        jButton3.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        jButton3.setText("删除用户");
        jButton3.addActionListener(new superadd_jButton3_actionAdapter(this));
        jButton4.setBounds(new Rectangle(280, 454, 113, 33));
        jButton4.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        jButton4.setText("添加用户");
        jButton4.addActionListener(new superadd_jButton4_actionAdapter(this));
        jButton5.setBounds(new Rectangle(130, 454, 113, 33));
        jButton5.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        jButton5.setText("查询用户");
        jButton5.addActionListener(new superadd_jButton5_actionAdapter(this));
        cboRegisteryear.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        cboRegisteryear.setBounds(new Rectangle(572, 278, 76, 28));
        jLabel9.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        jLabel9.setText("年");
        jLabel9.setBounds(new Rectangle(655, 286, 29, 15));
        cboRegistermonth.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        cboRegistermonth.setBounds(new Rectangle(678, 278, 59, 29));
        jLabel10.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        jLabel10.setText("月");
        jLabel10.setBounds(new Rectangle(739, 281, 36, 24));
        cboRegisterdate.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        cboRegisterdate.setBounds(new Rectangle(765, 280, 46, 28));
        jLabel11.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        jLabel11.setText("日");
        jLabel11.setBounds(new Rectangle(818, 279, 54, 24));
        this.add(txtid);
        this.add(tbsuper);
        this.add(jTableHeader1);
        this.add(cbotype);
        this.add(jLabel1);
        this.add(jLabel3);
        this.add(txtpassword);
        this.add(jLabel2);
        this.add(jLabel4);
        this.add(jLabel6);
        this.add(cboAppearance);
        this.add(jButton2);
        this.add(jButton1);
        this.add(jButton3);
        this.add(jButton4);
        this.add(jButton5);
        this.add(jLabel7);
        this.add(cboRegistermonth);
        this.add(cboRegisteryear);
        this.add(jLabel9);
        this.add(jLabel10);
        this.add(jLabel11);
        this.add(cboRegisterdate);
        this.add(txaRemarks);
        this.add(txtLogoff);
        this.add(jLabel5);
    }

    String head[] = {"用户名", "密码", "用户类型", "注册时间", "注销时间", "状态", "备注"};
    DefaultTableModel mod = new DefaultTableModel(head, 0);
    JTable tbsuper = new JTable(mod);
    JTableHeader jTableHeader1 = tbsuper.getTableHeader();
    JLabel jLabel1 = new JLabel();
    JTextField txtid = new JTextField();
    JLabel jLabel2 = new JLabel();
    JTextField txtpassword = new JTextField();
    JLabel jLabel3 = new JLabel();
    String type[] = {"", "超级管理员", "成绩管理员", "班级管理员", "学生管理员", "普通用户"};
    JComboBox cbotype = new JComboBox(type);
    JLabel jLabel4 = new JLabel();
    JTextField txtLogoff = new JTextField();
    JLabel jLabel5 = new JLabel();
    JLabel jLabel6 = new JLabel();
    String appearance[] = {"", "在线", "离线"};
    JComboBox cboAppearance = new JComboBox(appearance);
    JLabel jLabel7 = new JLabel();
    JTextArea txaRemarks = new JTextArea();
    JButton jButton1 = new JButton();
    JButton jButton2 = new JButton();
    JButton jButton3 = new JButton();
    JButton jButton4 = new JButton();
    JButton jButton5 = new JButton();
    String Registeryear[] = {"", "2004", "2005", "2006", "2007", "2008"};
//出生时间(月)
    String Registermonth[] = {"", "01", "02", "03", "04", "05", "06", "07",
                             "08",
                             "09",
                             "10", "11", "12"};
//出生时间(日)
    String Registerdate[] = {"", "01", "02", "03", "04", "05", "06", "07",
                            "08",
                            "09",
                            "10", "11", "12", "13", "14", "15", "16", "17",
                            "18", "19", "20", "21", "22", "23", "24", "25",
                            "26", "27", "28", "29", "30", "31"};

    JComboBox cboRegisteryear = new JComboBox(Registeryear);
    JLabel jLabel9 = new JLabel();
    JComboBox cboRegistermonth = new JComboBox(Registermonth);
    JLabel jLabel10 = new JLabel();
    JComboBox cboRegisterdate = new JComboBox(Registerdate);
    JLabel jLabel11 = new JLabel();
    public void jButton5_actionPerformed(ActionEvent e) {
        try {
            String daima =
                    "select useid,mima,Type,Register,Logoff,Appearance,Remarks from go where 1=1";
            if (!this.txtid.getText().equals("")) {
                daima += " and useid = '" + this.txtid.getText() + "'";
            }
            if (!this.txtpassword.getText().equals("")) {
                daima += " and mima = '" + this.txtpassword.getText() + "'";
            }
            if (!this.cbotype.getSelectedItem().toString().equals("")) {
                daima += " and Type = '" +
                        this.cbotype.getSelectedItem().toString() + "'";
            }
            if (!this.cboAppearance.getSelectedItem().toString().equals("")) {
                daima += " and Appearance='" +
                        this.cboAppearance.getSelectedItem().toString() + "'";
            }
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            Connection conn = DriverManager.getConnection("jdbc:odbc:studer");
            PreparedStatement sql = conn.prepareStatement(daima);
            ResultSet i = sql.executeQuery();
            mod.setNumRows(0);
            while (i.next()) {
                Object j[] = {i.getString(1), i.getString(2), i.getString(3),
                             i.getString(4), i.getString(5), i.getString(6),
                             i.getString(7)};
                mod.addRow(j);
            }
            tbsuper.updateUI();
            i.close();

⌨️ 快捷键说明

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