Display data in a ArrayList in a Jtable
I have an ArrayList o开发者_Python百科f 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.
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
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.
精彩评论