I have implemented a custom Table Model as follows:
public class MyTableModel extends AbstractTableModel {
...
...
@Override
public Class getColumnClass(int c) {
return getValueAt(0, c).getClass();
}
...
...
}
I am getting NullPointerException thrown by the above method, when I display a JTable having the above TableModel.
I think that the exception is due to some empty cells in the database table.
If the exception is due to empty cells in the database table, then how to get around with this problem?
It is not mandatory for every column in the database to have some value. Some columns can contain nothing.