I need to run some method in Swing application in separate thread. What is the difference between using SwingWorker and SwingUtilities.invokeLater. Which one should I use to run a thread in Swing application? I couldn’t find exact info in the tutorial at
http://java.sun.com/docs/books/tutorial/uiswing/concurrency/index.html
SwingUtilities.invokeLateris used if you have something that must run in the EDT.If you have a long-running task, you instead need to use a
SwingWorker, since it does not run on the EDT and therefore does not cause the GUI to freeze while it runs.