Can someone highlight on the differences between these two and the instances both are required?!
I have an application which uses both intercheably, but want to know if one is better than the other. Obviously they both accept Runnable object, and so for me – I think I can use which one I like.
Why these two similar functions in different classes? I know one is in awt and the other Swing, but don’t they do the same thing?
SwingUtilities.invokeLaterexists only becauseEventQueue.invokelaterwas introduced in 1.2, but Swing was available for 1.1. Swing in the JRE has always just called theEventQueueversion.swingall.jarhad some hack where it created a component, and executed pending operations on repaints.invokeLateris about theEventQueue. I suggest using the method directly.SwingUtilitiesis just a dumping ground. I have seen a lot usingSwingUtilities.invokeLaterpresumably in some kind of belief the Swing isn’t dependent upon AWT.