KasunKP
KasunKP

Reputation: 143

Display data in a ArrayList in a Jtable

I have an ArrayList of objects and I want to display that information in a jtable. When new information are generated the table needs to be updated. How can I do this? at least some help.

Upvotes: 1

Views: 3785

Answers (2)

camickr
camickr

Reputation: 324088

I have an ArrayList of objects

Sounds like the Bean Table Model can help you out.

Or, if you mean you have an ArrayList of ArrayLists, then you use the List Table Model.

Upvotes: 1

jzd
jzd

Reputation: 23629

Extend DefaultTableModel or AbstractTableModel and build a custom model or just use the plain DefaultTableModel. Have updates flow to this model and this will feed the JTable.

I would highly recommend reading over the tutorial as these are basic questions: http://download.oracle.com/javase/tutorial/uiswing/components/table.html

Upvotes: 5

Related Questions