permaculture playing cards*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Populating JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Populating JTable" Watch "Populating JTable" New topic
Author

Populating JTable

Peter Choi
Greenhorn

Joined: May 17, 2001
Posts: 2
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

Joined: Mar 23, 2000
Posts: 51
Take a look at DefaultTableModel and AbstractTableModel.
Peter Choi
Greenhorn

Joined: May 17, 2001
Posts: 2
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Populating JTable