• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How EventDispatchThread starts a new thread ?

 
Mohit J Kumar
Ranch Hand
Posts: 33
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Usually we call start() to start the execution of a thread but in Swing (code above) there is no such call.
How EDT starts the thread execution ???

Thanks
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How EDT starts the thread execution ???

You have this wrong. Read the documentation. SwingUtilities#invokeLater (or invokeAndWait) doesn't start* a new thread. What it does is this:
Causes doRun.run() to be executed asynchronously on the AWT event dispatching thread.


* If and only if the EDT isn't already started, then the call to this method will result in launching the EDT. That's not anything a client program has to concern itself with.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic