Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Populating data into JTable

 
Sri Rangan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Thanks
Sri
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic