📄 lookgrade.java
字号:
package E4;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Vector;
import java.io.File;
import java.io.*;
import java.util.StringTokenizer;
import javax.swing.table.*;
import java.sql.*;
//查找界面
class lookGrade extends JPanel implements ActionListener
{
String id="";
Object course [] = new Object[6];
public static JTable table;
AbstractTableModel tm;
public Vector content = new Vector();
String[] title_name = {"序号","学号","姓名","课程号","课程名","分数","学期"};
public static int jishu;
public static JLabel showNum=new JLabel("总数为:"+jishu);
JPanel jpl=new JPanel();
JPanel showDetail = new JPanel();
JButton jRefresh=new JButton("刷新");
JPanel forChoice=new JPanel();
proceeSQL psql= new proceeSQL();
lookGrade()
{
super.setSize(700,450);
super.setLocation(350,300);
super.setLayout(new BorderLayout(9,10));
tm = new AbstractTableModel(){
public String getColumnName(int col){return title_name[col];
}
public int getColumnCount(){return title_name.length;}
public int getRowCount(){return content.size();}
public Object getValueAt(int row,int col){return ((Vector)content.get(row)).get(col);}
};
table=new JTable(tm);
jpl.add(jRefresh);
jpl.add(showNum);
jpl.setLayout(new GridLayout(8,1,2,9));
super.add(jpl,BorderLayout.WEST);
super.add(new JScrollPane(table));
}
public void actionPerformed(ActionEvent e){
if(e.getSource()==jRefresh){
reFresh();
}
}
void reFresh(){
table.setVisible(false);
content.removeAllElements();
jishu = psql.getSCById(content,id);
table.setVisible(true);
showNum.setText("总数为:"+jishu);
}
void setId(String id){
this.id=id;
}
void setDisplay(Boolean tf){
super.setVisible(tf);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -