Haven't posted in a long time but I had to share this.
A framework called SpringRich, short of the fact that they have things like ComboBoxModels set as Inner classes, I came across this a class called TableUtils.
Has a method called: "attachSorter(JTable)"
One would think it would it would attach some sort of Sorter from the name, but on code investigation:
public static JTable attachSorter(JTable table) { TableModel tableModel = table.getModel(); ShuttleSortableTableModel sortedModel = new ShuttleSortableTableModel(tableModel); table.setAutoCreateColumnsFromModel(true); table.setModel(sortedModel); TableSortIndicator sortIndicator = new TableSortIndicator(table); new SortTableCommand(table, sortIndicator.getColumnSortList()); return table; }
WTF? I kept losing my JComboBox editor in my builder, couldn't for the life of me figure it out until I examined this code.
Lets see...
We have a static method that instead of simply adding functionality to your JTable, it strips it of some by setting its own ridiculous table model which fries your CellEditor.
Static methods should not reassign Objects on whatever you pass in unless explicitly mentioned.