• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Populating JTable

 
Peter Choi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me how to dynamically add a row in a JTable and populate it with data that is created at runtime. The data would be populated from an array of Strings.
 
Doug Melzer
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at DefaultTableModel and AbstractTableModel.
 
Peter Choi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Doug Melzer:
Take a look at DefaultTableModel and AbstractTableModel.

Doug
Thanks for the information, I decided to use the AbstractTableModel and implement a vector to hold my table Data, every time the vector gets a new element, i just call fireTableRowInserted() method. In this way table will auto increse a new row. of couse the vector initialised as null.
Cheers
Peter
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic