A fool issue with Swing / Open JDK 1.6
current package (Fedora 16): java-1.6.0-openjdk-devel-1:184.108.40.206-220.127.116.11.fc16 (64-bit)
My application  uses a class which handles the data (storing + calculation) , a JTable the present it and a JTableModel to connect data and JTable: JTable -> JTableModel -> data class. When removing a data set the application tells the JTableModel which calls the data class to remove the data set and runs the fireTableRowsDeleted(…) method to tell the JTable to remove the corresponding row.
This works fine if there is no cell in the edit mode. Otherwise – if a cell is in the edit mode – an exception (java.lang.IndexOutOfBoundsException) thrown from JTableModel telling that the JTableModel tries to read an index at data class which does not exist. I.e.: data class has 3 items (0..2) the removing item 2 raises the exception „java.lang.IndexOutOfBoundsException: Index: 2, Size: 2“ while the data class has now two items and JTable has now 2 rows => JTable and data class removed the items as it should but JTable did not recognize the change. A similar issue appeared when adding rows. Adding / removing columns is not a problem in my application because my application because adding or removing columns is allowed only in a JTable which can not be edited but if your application permits it the same problem would occur.
The solution was to kick all cells out of edit mode by running the JTable.editingCanceled(ChangeEvent) method for the JTable object i.e. („table“ = JTable object): „table.editingCanceled(new ChangeEvent(table));“ before removing or adding items.