I'll take a shot into the dark and guess that you want to accomplish something like this:
DefaultTableModel dtm = (DefaultTableModel)myJTable.getModel();
for (MyRowObject row : webSiteDownloader.getWebSites()) {
dtm.insertRow(0, row.toArray());
}
Is there a special reason that you're using insertRow instead of addRow?
Also, I'd really like to recommend that you roll your own special purpose TableModel by extending AbstractTableModel. Basic untested example:
public class MyTableModel extends AbstractTableModel
{
protected List<MyObject> rows;
public MyTableModel()
{
rows = new ArrayList<MyObject>();
}
public void add(MyObject obj)
{
rows.add(obj);
}
@Override
public int getRowCount()
{
return rows.size();
}
@Override
public int getColumnCount()
{
// This value will be constant, but generally you'd also
// want to override getColumnName to return column names
// from an array, and in that case you can return the length
// of the array with column names instead
return 2;
}
@Override
public Object getValueAt(int row, int column)
{
MyObject obj = rows.get(row);
// Change this to match your columns
switch(column) {
case 0: return obj.getId();
case 1: return obj.getName();
}
return null;
}
}