How to add rows to a TableModel?
1 posts in topic
Flat View  Flat View

Posted By:   Carlos_Lee
Posted On:   Wednesday, May 14, 2003 12:45 PM

I want to add rows to a JTable dynamically and someone told me to add rows to the TableModel but I still don't see any method to add a row to the table model. How can I do that? If you can send me any sample to my email it will be really great.


Re: How to add rows to a TableModel?

Posted By:   Bahman_Barzideh  
Posted On:   Wednesday, May 14, 2003 02:21 PM

What you do depends on your application. A JTable by default uses a DefaultTableModel. If this is what you are using, you can take advantage of either of the 2 addRow () or the 2 insertRow () methods provided by this class to accomplish what you want. If you have provided a custom TableModel then you need to make provisions for adding rows in the customized TableModel.

Also take a look at How to Use Tables for information on JTable which is what I assume you are using.
About | Sitemap | Contact