Hi all
I created a TableModel: ResultSetTableModel extends AbstractTableModel
the ResultSetTableModel use a Resultset in construct such as
public ResultSetTableModel(ResultSet re) {
this.resultset=re;
}
ResultSetTableModel's method getRowCount() is
public int getRowCount() {
try{
resultset.last();
return resultset.getRow();
}
catch(SQLException e)
{
e.printStackTrace();
return 0;
}
}
it compiled well but when i run it i get
Exception in
thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.xinhao.swing.ResultSetTableModel.getColumnCount(ResultSetTableModel.java:49)
How can I correct it?
the
java version is jdk1.6
thanks!