Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

TableSorter errors when adding new data  RSS feed

 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nobr]so here is the deal:

I am using the TableSorter.java helper class with DefaultTableModel
from: http://java.sun.com/docs/books/tutorial/uiswing/components/table.html

It works great when the data is static and I get it for the first time. however, occationally, when adding new data I get a NullPointerException error.

in use:
DefaultTableModel.addRow()
DefaultTableModel.removeRow() and
DefaultTableModel.insertRow() methods.

Error:
java.lang.ArrayIndexOutOfBoundsException: 5
at com.shared.model.TableSorter.modelIndex(TableSorter.java:294)
at com.shared.model.TableSorter.getValueAt(TableSorter.java:340)
at javax.swing.JTable.getValueAt(Unknown Source)
at javax.swing.JTable.prepareRenderer(Unknown Source)...


code problem I:



code problem II:

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!