Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception

 
Giuseppa Cefalu
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I am trying to add new rows to my JTable and edit them afterwrads. Only the first added row works. If I add a second row (inert button), it freezes (not editable) and I get the following error message Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 339 >= 339. The table has 337 row originally. After adding one row, it reports having 338. Row 339 is inserted; but is not editable. The first method is in the class that creates the GUI. The second one is in the AbstractTableModel class. Please help? Thank you.

Here is the code:



 
Giuseppa Cefalu
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found out what the problem is : It is in the method that defined the data types for the cells. If the last row of the table does not have a valuue, the code inserts null (; if(newRow.elementAt(k) == null){
newRowVector.addElement(null);
but does not define the data type for the cell. May be I can get what the corresponding column data type is? Any suggestions.
Thank you.


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic