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.
And so: you can't use a DefaultTableModel like that. There are two main alternatives:
(1) Write your own table model which is based on a List<Contact> -- a subclass of AbstractTableModel would be easy enough.
(2) Convert each Contact object to a Vector, and then you have a Vector<Vector> which you can pass to your DefaultTableModel.
Which you choose would depend on how the table is supposed to work. Is it editable? Or partially editable? Do you want to specify column types so that rendering of types other than String will look nicer? Do you want changes to the table model's data to result in changes to other entities? And so on...
3. When clicking on a row in the jTable I need to be able to reference a first column primary key (data is being loaded from a db table) that will eventually be used to access and update a record in a db table.
Which method is best suited for this.....#1 or #2 from your reply to my post. Thanks.