Domanda

I use a SwingWorker to change a DefaultTableModel according to changes in a database. My question is: is it safe to add a ListSelectionListener and a TableModelListener to the DefaultTableModel in doInBackground(), or do they have to be added in done()?

È stato utile?

Soluzione

Any action that modifies any GUI component in any way should be performed on the EDT. You should be adding the listeners in done.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top