Can anyone tell me is there a difference between these, is one perfered over the other and why would I want to use one over the other?
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Can anyone tell me is there a difference between these, is one perfered over the other and why would I want to use one over the other?
From the SwingUtilities API: SwingUtilities (Java Platform SE 6)
public static void invokeLater(Runnable doRun)
...
As of 1.3 this method is just a cover for java.awt.EventQueue.invokeLater().
Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
That's really not helping me. I've always used SwingUtilities.invokeLater(new Runnable); but recently installed Eclipse 3.7 Indigo and with the WindowsBuilder when you build a new JFrame project now it uses EventQueue.invokeLater(new Runnable); Is there a reason for this, or is it just a preference of style.
Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
I'm not trying to be arrogant sorry, I'm just trying to learn having come over from the .NET world. I tried to find the link, but I thought I read somewhere yesterday that they said when Swing was introduced SwingUtilities had a problem with possible deadlock on large appications, where the EventQueue would be more reliable. I know they work with the event dispatch thread at least I thought I remember this much. so I came here where I trust the experts. I appriciate your insight and just trying to learn all I can.
It's okay.
What you're saying may have been true before 1.3, but that was a long time ago. Now, the SwingUtilities methods simply call the EventQueue methods, so they're the same. But people continue to use whichever one they see in the tutorials (I use SwingUtilities), which may have been written before 1.3. But it really doesn't matter.
Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
Thank you!