3

I am using using the Netbeans 7 IDE to develop a GUI desktop application. When I create the JFrame class , Netbeans uses the

java.awt.EventQueue.invokeLater(new Runnable() { }

To initiate the runnable object. But my application has swing components as well.

I will like to know the difference between the

 java.awt.EventQueue threads

and

SwingUtilities threads

for GUI application development.

mKorbel
  • 109,107
  • 18
  • 130
  • 305
CodeAngel
  • 577
  • 1
  • 10
  • 31
  • 3
    Possible duplicate [look here](http://stackoverflow.com/questions/10333525/eventqueue-invokelater-vrs-swingutilities-invokelater) – Azad May 28 '13 at 12:10
  • `SwingUtilities.invokeLater` is still with us for historic reasons only, to maintain backwards compatibility. Apart from that, they are the same thing. – Marko Topolnik May 28 '13 at 12:30
  • possible duplicate of [SwingUtilities.invokeLater() vs EventQueue.invokeLater()](http://stackoverflow.com/questions/8847083/swingutilities-invokelater-vs-eventqueue-invokelater) – fredoverflow Jun 10 '15 at 07:01

2 Answers2

5

According to the doc here

As of 1.3 SwingUtilities.invokeLater() method is just a cover for java.awt.EventQueue.invokeLater().

Also the source of SwingUtilities here

public static void invokeLater(Runnable doRun) {
    EventQueue.invokeLater(doRun);
}
stinepike
  • 52,673
  • 14
  • 90
  • 109
4

Both are actually the same. SwingUtilities.invokeLater directly calls EventQueue.invokeLater (ref).

As of 1.3 this method is just a cover for java.awt.EventQueue.invokeLater().

Howard
  • 37,615
  • 8
  • 61
  • 82