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

📄 remarkdel.java~4~

📁 java语言做的教务管理系统
💻 JAVA~4~
字号:
package java_教务管理系统;

import java.awt.*;

import javax.swing.*;
import java.awt.Rectangle;
import javax.swing.table.JTableHeader;
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

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

    private void jbInit() throws Exception {
        this.setLayout(null);
        jLabel1.setText("考试次数:");
        jLabel1.setBounds(new Rectangle(15, 200, 60, 15));
        jLabel2.setText("考试时间:");
        jLabel2.setBounds(new Rectangle(53, 172, 60, 15));
        txtresultstuno.setBounds(new Rectangle(64, 140, 54, 20));
        jLabel3.setText("学号:");
        jLabel3.setBounds(new Rectangle(25, 142, 36, 15));
        jLabel4.setText("任课老师:");
        jLabel4.setBounds(new Rectangle(275, 142, 60, 15));
        txtlessonteacher.setBounds(new Rectangle(335, 140, 95, 20));
        jLabel5.setText("课程名称:");
        jLabel5.setBounds(new Rectangle(132, 142, 60, 15));
        txtresult.setBounds(new Rectangle(296, 198, 95, 20));
        txaresultremarks.setBounds(new Rectangle(89, 227, 302, 63));
        jLabel6.setText("成绩:");
        jLabel6.setBounds(new Rectangle(245, 200, 36, 15));
        cboexaminationdatedate.setBounds(new Rectangle(295, 168, 48, 23));
        txtexaminationnumber.setBounds(new Rectangle(89, 199, 115, 20));
        jLabel7.setText("日");
        jLabel7.setBounds(new Rectangle(349, 173, 12, 15));
        cboexaminationdateyear.setBounds(new Rectangle(118, 168, 69, 23));
        cboexaminationdatemonth.setBounds(new Rectangle(212, 168, 59, 23));
        jLabel8.setText("月");
        jLabel8.setBounds(new Rectangle(278, 172, 12, 15));
        jLabel9.setText("备注:");
        jLabel9.setBounds(new Rectangle(37, 233, 36, 15));
        txtresultclassno.setBounds(new Rectangle(195, 140, 73, 20));
        jLabel10.setText("年");
        jLabel10.setBounds(new Rectangle(194, 172, 12, 15));
        tbremark.setBounds(new Rectangle(5, 23, 447, 114));
        jTableHeader1.setBounds(new Rectangle(1, 0, 451, 23));
        brnselect.setBounds(new Rectangle(58, 310, 81, 23));
        brnselect.setText("搜索成绩");
        brnselect.addActionListener(new remarkdel_brnselect_actionAdapter(this));
        btndel.setBounds(new Rectangle(189, 310, 81, 23));
        btndel.setText("删除成绩");
        btnexit.setBounds(new Rectangle(340, 310, 81, 23));
        btnexit.setText("退出删除");
        this.add(txaresultremarks);
        this.add(jLabel9);
        this.add(jLabel1);
        this.add(txtexaminationnumber);
        this.add(jLabel6);
        this.add(txtresult);
        this.add(cboexaminationdatedate);
        this.add(jLabel7);
        this.add(jLabel4);
        this.add(txtresultclassno);
        this.add(cboexaminationdatemonth);
        this.add(jLabel8);
        this.add(jLabel10);
        this.add(cboexaminationdateyear);
        this.add(jLabel2);
        this.add(txtresultstuno);
        this.add(jLabel5);
        this.add(jLabel3);
        this.add(txtlessonteacher);
        this.add(tbremark);
        this.add(jTableHeader1);
        this.add(brnselect);
        this.add(btndel);
        this.add(btnexit);
    }

    String year[] = {"", "2006", "2007", "2008", "2009"};
    String month[] = {"", "01", "02", "03", "04", "05", "06", "07",
                     "08",
                     "09",
                     "10", "11", "12"};
    String date[] = {"", "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"};
    JLabel jLabel1 = new JLabel();
    JLabel jLabel2 = new JLabel();
    JTextField txtresultstuno = new JTextField();
    JLabel jLabel3 = new JLabel();
    JLabel jLabel4 = new JLabel();
    JTextField txtlessonteacher = new JTextField();
    JLabel jLabel5 = new JLabel();
    JTextField txtresult = new JTextField();
    JTextArea txaresultremarks = new JTextArea();
    JLabel jLabel6 = new JLabel();
    JComboBox cboexaminationdatedate = new JComboBox(date);
    JTextField txtexaminationnumber = new JTextField();
    JLabel jLabel7 = new JLabel();
    JComboBox cboexaminationdateyear = new JComboBox(year);
    JComboBox cboexaminationdatemonth = new JComboBox(month);
    JLabel jLabel8 = new JLabel();
    JLabel jLabel9 = new JLabel();
    JTextField txtresultclassno = new JTextField();
    JLabel jLabel10 = new JLabel();
    String head[] = {"学号", "考试名称", "任课老师", "考试时间", "考试次数", "成绩", "备注"};
    DefaultTableModel mod = new DefaultTableModel(head, 0);
    JTable tbremark = new JTable(mod);
    JTableHeader jTableHeader1 = tbremark.getTableHeader();
    JButton brnselect = new JButton();
    JButton btndel = new JButton();
    JButton btnexit = new JButton();

    String timename =
            this.cboexaminationdateyear.getSelectedItem().toString() + "-" +
            this.cboexaminationdatemonth.getSelectedItem().toString() + "-" +
            this.cboexaminationdatedate.getSelectedItem().toString() + " ";
    public void brnselect_actionPerformed(ActionEvent e) {
        try {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            Connection nod = DriverManager.getConnection("jdbc:odbc:studer");
            String daima = "select resultstuno,resultclassno,lessonteacher,examinationdate,examinationnumber,result,resultremarks from result where 1=1";
            if (!this.txtresultstuno.getText().equals("")) {
                daima += " and classno = '" + this.txtresultstuno.getText() + "'";
            }
            if (!this.txtresultclassno.getText().equals("")) {
                daima += " and classmastername ='" +
                        this.txtresultclassno.getText() + "'";
            }
            if (!this.txtlessonteacher.getText().equals("")) {
                daima += " and classcategory ='" + this.txtlessonteacher.getText() + "'";
            }
            if (!this.txtexaminationnumber.getText().equals("")) {
                daima += " and beginstime = '" + this.txtexaminationnumber.getText() + "'";
            }
            if (!this.txtresult.getText().equals("")) {
                daima += " and beginstime = '" + this.txtresult.getText() + "'";
            }
            PreparedStatement sql = nod.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);
            }
            tbremark.updateUI();
            i.close();
            sql.close();
            nod.close();
        } catch (Exception ex) {

        }

    }
}


class remarkdel_brnselect_actionAdapter implements ActionListener {
    private remarkdel adaptee;
    remarkdel_brnselect_actionAdapter(remarkdel adaptee) {
        this.adaptee = adaptee;
    }

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

⌨️ 快捷键说明

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