The Complete Java2 Certification Study Guide by Roberts, Heller, and Ernest wrote:
... DefaultTableColumnModel provides a standard implementation and includes event "firing" methods that broadcast changes in column behavior --- deletion, addition, order change, selection change, and margin change ... TableModel adds a layer of control on top of column objects, which allows an implementation of the interface to return information on its table --- row count, column count, and column names among them ... One aspect of model-view relationships that may take some getting used to is that the data model representations maintain column order independent of the view. When we want to rearrange data on the view level, for example, we don't want to be restricted to the model's internal arrangement of columns. We may decide we would rather have last names before first names or states before zip codes.
Hi,
I have implemented an MVC architected presentation layer in my
SCJD assignment. The problem is that the data that I get from the database is ordered in a
String[], and the data in my data model is ordered in the same way. My view is dependent upon the order of the data received from the data model. Did anyone else have this problem, and did you use DefaultTableColumnModel to decouple the view from the data model?
Thanks,
Harry