开发者

new Thread created when calling SwingUtilities.invokeAndWait()?

开发者 https://www.devze.com 2023-03-03 18:31 出处:网络
Is a new Thread created when Runnable开发者_如何学Go is used with SwingUtilities.invokeAndWait()?No,a new thread is not created when Runnable is used with SwingUtilities.invokeAndWait().

Is a new Thread created when Runnable开发者_如何学Go is used with SwingUtilities.invokeAndWait()?


No,a new thread is not created when Runnable is used with SwingUtilities.invokeAndWait(). The Event Thread will end up calling the run() method of the Runnable when it's turn comes up on the event queue.


invokeAndWait API.

Causes doRun.run() to be executed synchronously on the AWT event dispatching thread


No. The purpose of the method is to run the Runnable on the GUI event thread, which I would assume you have already.


In short, no. The current thread blocks until the EventQueue runs the Runnable.


Causes doRun.run() to be executed synchronously on the AWT event dispatching thread.

no it triggers an event on the AWT event thread (which is already running in gui apps)

0

精彩评论

暂无评论...
验证码 换一张
取 消