File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Populating data into JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Populating data into JTable " Watch "Populating data into JTable " New topic

Populating data into JTable

Sri Rangan
Ranch Hand

Joined: Dec 08, 2001
Posts: 160
1. From Database, I get a collection of DataObjects (Each Data Object will represent a row in the Database table). I, now, loop thru the collection to create the Vector of rows and setting it to my Model class which is derived from DefaultTableModel.
2.When ever I update the database, I get the row selected and the data Vector and unwrap the data vector to creat the dataobject. This steps seems to be extra work. IS there any better way to populate the data?
3.After populating the values into JTable, I need to keep track of the values(at cell level), user changes/selecting. My table cells have JCheckBox or JComboBox. I can think of having a dirty flag for every cell. But I am not able to think how to implement it. Any help with sample code will be appreciated.
I agree. Here's the link:
subject: Populating data into JTable
It's not a secret anymore!