hey there,

I am trying to build a small around soccer/football matches. So, I have built a class that models a Match (Match.java). It only contains field variables like hostid, guestid, matchid, result, and such, and setter and getter methods.

When I retrieve matches from my sqlite database, I build a Match object out of each row, and add the object to an ArrayList<Match>.

So far so good. Now, when I want to put my arraylist on a JTable, I am having difficulties. I find JTable's constructor that accepts two parrameters JTable(Object[][] rowData, Object[] columnNames) very interesting, but I haven't built a method to put my Match fields onto an array to build the Object[][] rowData array.

I was wondering if someone could advise me on whether I should just build this two-dimensional array out of my Matches and their fields, or is there perhaps a completely different method to better display the info of my matches onto a table (something different from JTable).

thank you.

I can't see reason for creating ArrayList<Match>

look for (Vector<Vector<Object>> rowData, <Vector<String>columnNames)

some loop....
Vector<Object> row = newVector<Object>();
end of some loop....

or better

DefaultTableModel#addRow, then just JTable#setModel(DefaultTableModel)

hey mKorbel,
thank you for your reply. I will take your advise and proceed that way. appreciate it.

P.S. Let me congratulate you for how fast and how much you improved your English. Best regards.

This question has already been answered. Start a new discussion instead.