aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Exception" Watch "Exception" New topic
Author

Exception

Giuseppa Cefalu
Ranch Hand

Joined: Jul 15, 2011
Posts: 121
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

Joined: Jul 15, 2011
Posts: 121
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.


 
jQuery in Action, 2nd edition
 
subject: Exception