Unfortunately, that class re-implemented moveColumn(int, int), which meant that moving a column in the view also changed its order in the list of all columns.
As Rob pointed out, the order of the columns in "the model" is not supposed to change;
but I'm still trying to get a conceptual understanding of column-handling in JTable, and that's turning out to be a lot more difficult than it should be...
Rob Camick wrote:
Unfortunately, that class re-implemented moveColumn(int, int), which meant that moving a column in the view also changed its order in the list of all columns.
That is correct, that is what should happen.
Rob Camick wrote:
As Rob pointed out, the order of the columns in "the model" is not supposed to change;
That is not what I said. I said the order of the columns in the TABLE model is not supposed to change.
Rob Camick wrote:
I suggested the problem was with you getColumnClass() method because it references your TableColumnModel. The TableModel should not access or care about the TableColumnModel.
MyDisplayColumns extends Steven Kelvin's "ExtendedTableColumnModel", which has some code in it for holding references to columns that are not currently visible; I used Mr. Kelvin's code as a starting point.
No, that was a bug. I said it was a bug; when I took that out, the program started working correctly.
It's normally called MVC,
And I have no evidence that you know more about it than I do, no matter how many words you put in caps and boldface.
What you have said about the design is off-topic.
I was asking about this same subject some weeks ago.
Liar, liar, pants on fire! refreshing plug:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
|