tags:

views:

58

answers:

1

I have a TableModel that is populated from a background running thread. I am calling fireTableRowsInserted when data is inserted, which is NOT on the EDT.

My question is, do I need to use invokeLater for the fireTableRowsInserted?

In other words, is the below correct:

public void putData(TableRow row) {
    // we are not on the EDT here...
    rows.add(row);
    fireTableRowsInserted(rows.size()-1, rows.size()-1);
}
+1  A: 

Well, as this event may trigger table repaint, it should be in the EDT, yes. But you can rely upon SwingUtilities.invokeLater to have only the relevant part called in EDT.

Riduidel