This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I implemented sorting example on sun's website: http://java.sun.com/docs/books/tutorial/uiswing/components/table.html . However, there is problem with this code. As I understand TableSorter acts as a shell for my current TableModel, so when I sort JTable is makes changes to TableSorter and TableMap classes but not the TableModel that I use. What should I do so that when I sort JTable, the original TableModel changes as well? thanks, Alex
All right brain, you don't like me and I don't like you, but let's just do this one thing so I can get back to killing you with beer.<br /> <br />- Homer Simpson
The benefit of this technique is that allows you to use models that are not sortable. TableSorter is a generic sorter that can be applied to any table. If you really want to sort the model, do not use a wrapper for the model . Just use a model that knows how to sort its data. For instance via the Collections.sort(...) methods, or SortedSet/Map types.