I would advise using javax.swing.Timerfor this problem, which periodically triggers ActionEventevents in the thread sending (note that you should only rename and / or manipulate Swing components from this thread). You can then determine ActionListenerto intercept the event and repaint your component at that moment.
Example
JComponent myComponent = ...
int delay = 1000;
ActionListener taskPerformer = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
myComponent.repaint();
}
};
new Timer(delay, taskPerformer).start();
, SwingWorker, , , , , .