If you always been using column numbers when implementing your TableModel, you’ll know that it a burden when you have to change the order of the columns.
If you normally do the following in your TableModel implementation:
@Override public String getColumnName(int column) {
switch(column) {
case 0: return "Closing Date";
case 1: return "Open Price";
case 2: return "Day High";
case 3: return "Day Low";
case 4: return "Close< Price";
}
return null;
}
You'll have to go through the source code and re-number each column whenever you need to change the order of the columns. There will be multiple places to update, such as the getColumnName and getValueAt methods. If you do complex rendering then you will also need to update the TableCellRenderer implementation as well.
To avoid hardcoding the column numbers, you can use enums. Enums are both more descriptive and have ordinal values.

