lookupallstudents.java
来自「学生选课管理系统」· Java 代码 · 共 51 行
JAVA
51 行
package main;
import java.util.Vector;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import db.StudentinformationBiz;
public class LookupAllStudents extends JFrame{
private JPanel jpanel1=new JPanel();
private JTable jtable1=new JTable();
public LookupAllStudents(){
init1();
init2();
}
private void init1() {
this.setLayout(null);
this.setSize(497,404);
this.setLocationRelativeTo(this);
this.setVisible(true);
this.setTitle("学生信息");
this.jpanel1.setBounds(15,10,455,340);
this.jpanel1.setLayout(null);
this.jpanel1.setBorder(BorderFactory.createTitledBorder("学生信息"));
this.jtable1.setBounds(15,25,425,290);
this.jpanel1.add(this.jtable1,null);
this.add(this.jpanel1,null);
}
private void init2() {
Vector <Vector> data=new Vector();
Vector head=new Vector();
StudentinformationBiz db=new StudentinformationBiz();
DefaultTableModel tableModel=(DefaultTableModel)jtable1.getModel();
head=db.getColumn();
data=db.findAll();
tableModel.setDataVector(data, head);
((DefaultTableModel)jtable1.getModel()).fireTableStructureChanged();
}
public static void main(String[]args){
new LookupAllStudents();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?