I generated a Swing interface with NetBeans. Everything works well, until I change rowCount
to 4096. Now I get the exception NoClassDefFoundError
. I've tested that from rowCount
3850 it breaks. Is this is a bug, or something else; all tips are welcome. How can I increase that rowCount
correctly?
You usually use a JTable to display a collection of data that has a specific number n of objects. This number should be returned by getRowCount()
. You do not use any arbitrary integer there, but the size n of your data collection.
Check your getValueAt(int row, int col)
. Maybe it tries to access an non existent object. You can only manipulate the size of JTable with getRowCount if you create a multiplication table for example, where you define your table size with the integer returned by getValueAt. Only in this case you are free to modify the getRowCount to return whatever you wish.
public Object getValueAt(int rowIndex, int columnIndex) {
return (rowIndex +1 ) * (columnIndex + 1);
}
If you have a ResultSet, a Vector, an ArrayList etc, get and return its size in getRowCount.