publicvoidthis_windowOpened(WindowEvente){Vectorhead=newVector();head.addElement("姓名");head.addElement("学号");head.addElement("性别");head.addElement("年级");head.addE...
public void this_windowOpened(WindowEvent e) {
Vector head = new Vector();
head.addElement("姓名");
head.addElement("学号");
head.addElement("性别");
head.addElement("年级");
head.addElement("班级");
head.addElement("班主任");
head.addElement("家庭地址");
Vector head1 = new Vector();
DateBase jdbc = new DateBase();
String st = "select * from student";
jdbc.load();
jdbc.query(st);
try {
while (jdbc.rs.next()) {
Vector a = new Vector();
a.addElement(jdbc.rs.getString(1));
a.addElement(jdbc.rs.getString(2));
a.addElement(jdbc.rs.getString(3));
a.addElement(jdbc.rs.getString(4));
a.addElement(jdbc.rs.getString(5));
a.addElement(jdbc.rs.getString(6));
a.addElement(jdbc.rs.getString(7));
head1.add(a);
}
} catch (SQLException ex) {
}
DefaultTableModel model = new DefaultTableModel(head1, head);
this.jTable1.setModel(model);
}
帮忙看这这段代码 自定义的表头不显示 不知道为什么
展开