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

📄 query_grade_frame.java

📁 用java实现的学生管理系统
💻 JAVA
字号:
package xscjgl;
import javax.swing.JOptionPane;
import java.awt.*;
import xscjgl.*;
import javax.swing.*;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import com.borland.dbswing.JdbTable;
import com.borland.dbswing.JdbTextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import com.borland.dx.sql.dataset.Load;
import com.borland.dx.sql.dataset.QueryDescriptor;
import com.borland.dx.sql.dataset.ConnectionDescriptor;
import com.borland.dx.sql.dataset.Database;
import com.borland.dx.sql.dataset.QueryDataSet;
import java.sql.ResultSet;
import javax.swing.BorderFactory;
import com.borland.dbswing.TableScrollPane;

/**
 * <p>Title: java xscjgl</p>
 *
 * <p>Description:学生查成绩,管理员输成绩、管理。二种权限的学生成绩管理系统 </p>
 *
 * <p>Copyright: lixing (c) 2006</p>
 *
 *
 * @author 04级计算机教育班 黎兴
 * @version 1.0
 */
public class Query_Grade_Frame extends JFrame {
    XYLayout xYLayout1 = new XYLayout();
    JPanel jPanel1 = new JPanel();
    XYLayout xYLayout2 = new XYLayout();
    Database database1 = new Database();
    QueryDataSet queryDataSet1 = new QueryDataSet();
    JLabel jLabel1 = new JLabel();
    JLabel jLabel2 = new JLabel();
    JTextField jTextField1 = new JTextField();
    JLabel jLabel3 = new JLabel();
    JLabel jLabel4 = new JLabel();
    JTextField jTextField2 = new JTextField();
    JdbTextField jdbTextField1 = new JdbTextField();
    JdbTextField jdbTextField2 = new JdbTextField();
    JButton jButton1 = new JButton();
    JPanel jPanel2 = new JPanel();
    XYLayout xYLayout3 = new XYLayout();
    JLabel jLabel5 = new JLabel();
    JLabel jLabel6 = new JLabel();
    JLabel jLabel7 = new JLabel();
    public String SNO;
    public String countAvg;
    public String countSum;
    public int countStudent;
    JLabel jLabel9 = new JLabel();
    JdbTextField jdbTextField3 = new JdbTextField();
    TableScrollPane tableScrollPane1 = new TableScrollPane();
    JdbTable jdbTable1 = new JdbTable();
    public Query_Grade_Frame() {
        try {
            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        getContentPane().setLayout(xYLayout1);
        setSize(new Dimension(570,450));
        setTitle("学生成绩查询窗体");
        xYLayout1.setWidth(561);
        xYLayout1.setHeight(468);
        jPanel1.setBackground(new Color(227, 241, 255));
        jPanel1.setBorder(BorderFactory.createLoweredBevelBorder());
        jPanel1.setLayout(xYLayout2);
        this.getContentPane().setBackground(new Color(248, 249, 244));

        database1.setConnection(new ConnectionDescriptor("jdbc:odbc:mydb",
                "tqti", "111111", false, "sun.jdbc.odbc.JdbcOdbcDriver"));
         database1.setDatabaseName("");
         queryDataSet1.setQuery(new QueryDescriptor(database1,
                "select * from gradeQuery where Sno='200440914101'", null, true, Load.ALL));
        jLabel1.setText("您的成绩如下:");
        jLabel2.setToolTipText("");
        jLabel2.setText("总分为:");
        jTextField1.setText("jTextField1");
        jLabel3.setText("平均分:");
        jLabel4.setText("单科信息:");
        jTextField2.setText("jTextField2");
        jdbTextField1.setText("jdbTextField1");
        jdbTextField1.setColumnName("Cname");
        jdbTextField1.setDataSet(queryDataSet1);
        jdbTextField2.setText("jdbTextField2");
        jdbTextField2.setColumnName("Cgrade");
        jdbTextField2.setDataSet(queryDataSet1);
        jButton1.setText("单科排名");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(ActionEvent e) {
                jButton1_actionPerformed(e);
            }
        });

        jPanel2.setLayout(xYLayout3);
        jLabel5.setText("课 程 名:");
        jLabel6.setText("课程分数:");
        jLabel7.setText("统计信息:");
        jLabel9.setText("课 程 号:");
        jdbTextField3.setText("jdbTextField3");
        jdbTextField3.setColumnName("Cno");
        jdbTextField3.setDataSet(queryDataSet1);
        jPanel2.setBackground(new Color(241, 249, 249));
        jPanel2.setBorder(BorderFactory.createEtchedBorder());
        jdbTable1.setDataSet(queryDataSet1);

        this.getContentPane().add(jLabel1, new XYConstraints(20, 20, -1, -1));
        jPanel2.add(jdbTextField1, new XYConstraints(84, 67, 108, -1));
        jPanel2.add(jLabel6, new XYConstraints(18, 100, -1, -1));
        jPanel2.add(jLabel5, new XYConstraints(18, 70, -1, -1));
        jPanel2.add(jdbTextField2, new XYConstraints(84, 97, 107, -1));
        jPanel2.add(jLabel9, new XYConstraints(18, 43, -1, -1));
        jPanel2.add(jdbTextField3, new XYConstraints(84, 40, 107, -1));
        jPanel2.add(jButton1, new XYConstraints(103, 9, -1, -1));
        jPanel2.add(jLabel4, new XYConstraints(18, 13, -1, -1));
        jPanel2.add(jLabel7, new XYConstraints(300, 17, -1, -1));
        jPanel2.add(jTextField2, new XYConstraints(366, 64, 107, -1));
        jPanel2.add(jTextField1, new XYConstraints(366, 35, 107, -1));
        jPanel2.add(jLabel3, new XYConstraints(300, 67, -1, -1));
        jPanel2.add(jLabel2, new XYConstraints(300, 38, -1, -1));
        tableScrollPane1.getViewport().add(jdbTable1);

        this.getContentPane().add(jPanel2, new XYConstraints(14, 41, 545, 136));
        this.getContentPane().add(jPanel1, new XYConstraints(14, 188, 545, 237));
        jPanel1.add(tableScrollPane1, new XYConstraints(6, 0, 535, 199));

    }



       public static void main(String args[]){
        Query_Grade_Frame queryGrade=new Query_Grade_Frame();
        queryGrade.setVisible(true);
        queryGrade.setLocationRelativeTo(null);



    }


    public void jButton1_actionPerformed(ActionEvent e) {
        String CNO=jdbTextField3.getText().trim().toString();
        Grade_CountInformation order = new Grade_CountInformation();
        order.setSubjectOrder(CNO,SNO);
        //排名
        int subjectOrder=order.getsubjectOrder();
        //该门课程的学生数目
        int sutdentCount=order.getCountStudent();
        JOptionPane.showMessageDialog(null,"共有"+sutdentCount+"名学生学习了该课程,\n你是第"+subjectOrder+"名!");
    }




}

⌨️ 快捷键说明

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