I need to feed test data to a Swing interval over a time period. The data set is long to parse, so I’m using a SwingWorker to parse it in the background. When it comes to feeding the data to the GUI (say, one item per second), I could start a Timer from the SwingWorker, but this seems overkill. Any reasons not to sleep from within the SwingWorker itself?
Cheers
Since
SwingWorkerdoesn’t run on the EDT, sleeping within is perfectly fine.In my opinion, a
Timerin addition to aSwingWorkerwould be overkill. Instead, just publish the parsed test data whenever possible, even at irregular intervals.