📄 lookupallstudents.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -