I need some guidance on how I can populate a JTable from a DB. I think I may have to extend AbstractTableModel and retrieve the data in this implementation. Then pass that to the JTable? I am not sure. I just want to know the best way to show the users this table that has a fixed number or rows and cells. Any code reference or other ideas would be greatly appreciated. Thanks. I already can connect to the DB and execute queries. I just don't know what to do with the recordset once I have it.
Just what you said. Put the data into the Model and add it the the JTable.
Joined: Sep 27, 2001
Do I need to extend the AbstractTabelModel or is there another TableModel I can use? Thanks for you help.
Joined: May 17, 2001
You could look at DefaultTableModel. Or you could just use the JTable constructor which take either Object or Vector and leave it at that. It really all depends on what you have to do. The Java tutorial on tables is pretty good. It should help you decide what path is best for your requirements.