JFrame 和JInternalFrame 有什么区别?????????
还有我的这段代码为么总是监听出错?????????
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:jsj01";
Connection conn = DriverManager.getConnection(url);
Statement stat = conn.createStatement();
String sql="select * from stu where xuhao='"+jTextField1.getText()+"' ";
ResultSet rSet = stat.executeQuery(sql);
boolean more= rSet.next();
int j=1;
while (more)
{
j++;
more=rSet.next();
}
j--;
Object[][] data=new Object[j][12];
Object[] Colname={"姓名","性别","出生日期","民族","籍贯","学历","毕业学校","住址","入学层次","专业","通知书编号","身份证号"};
ResultSet rSet2 = stat.executeQuery(sql);
rSet2.next();
for(int i=0;i<j;i++)
{
data[i][0] =rSet2.getString(1);
data[i][1] =rSet2.getString(2);
data[i][2] =rSet2.getString(3);
data[i][3] =rSet2.getString(4);
data[i][4] =rSet2.getString(5);
data[i][5] =rSet2.getString(6);
data[i][6] =rSet2.getString(7);
data[i][7] =rSet2.getString(8);
data[i][8] =rSet2.getString(11);
data[i][9] =rSet2.getString(12);
data[i][10] =rSet2.getString(16);
data[i][11] =rSet2.getString(15);
rSet2.next();
}
table = new JTable(data,Colname);
table.setDoubleBuffered(true);
table.setColumnSelectionAllowed(true);
jScrollPane.getViewport().add(table,null);
rSet.close();
}
catch(java.lang.Exception exec)
{
cuowuDialog aboutDialog = new cuowuDialog(this,"guanyu",false);
Dimension dlgSize = new Dimension(350,150);
Dimension frmSize=getSize();
Point loc=getLocation();
aboutDialog.setLocation((frmSize.width -dlgSize.width)/ 2+loc.x,(frmSize.height-dlgSize.height)/2+loc.y);
aboutDialog.setModal(true);
aboutDialog.setSize(dlgSize);
aboutDialog.jLabel1.setText("对不起,没有此学生信息");
aboutDialog.show();
}