In the java api for AbstractTableModel, the parameters to fireTableCellUpdated
are named row
and column
. The parameters to fireTableRowsDeleted
, fireTableRowsInserted
, and fireTableRowsUpdated
have parameters named firstRow
and lastRow
. getValueAt
and setValueAt
(from TableModel), uses the names rowIndex
and columnIndex
. Is there any meaning behind the lack of suffix "Index"? Does it mean that I need to add one to rowIndex
before passing row
to 'fireTableCellUpdated' or firstRow
to fireTableRowsInserted
?
Asked
Active
Viewed 66 times
1

mKorbel
- 109,525
- 20
- 134
- 319

Chad Skeeters
- 1,468
- 16
- 19
-
1Short answer, no, it's just what who ever wrote the methods choose to use. It's fesiable that the API was expanded upon over a period of time, so the person who wrote the original (non-index suffixed) API was not the same person who wrote the index suffixed API. You could also get into a long winded argument over the use of the index suffix, me personally, I'd just like consistency :P – MadProgrammer Jan 19 '16 at 23:46
1 Answers
1
I've seen conventions where the use of the "Index" suffix indicates that the first value starts with 0, and "Number" indicates possible values starting with 1. No suffix may be ambiguous and require inspecting the code or looking at examples.
In the How to use Tables tutorial, there is a sample implementation of AbstractTableModel. In this example, they implement setValueAt
and drop the "Index" suffix to the parameters compared to the method defined in TableModel. This is cosmetic, but they also pass those parameters to fireTableCellUpdated
without adding 1 to the row
and column
parameters. Therefore, I conclude that fireTableCellUpdated
's row and column variables are index based too.

Chad Skeeters
- 1,468
- 16
- 19