Meaningless Drivel is fun!*
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Exception" Watch "Exception" New topic


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){
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.

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Exception
Similar Threads
Stuck with KMeans Clustering Algorithm
Create JTable custom editor to validate againts string data type
JTable AbstractTableModel Edit Date Problem
Invisible JTable Column Header!