What does this statement mean?

unlike SwingUtilities.invokeAndWait(), the event thread is permitted to call SwingUtilities.invokeLater(). I do not understand this clearly.

Please help me with this.

+2
source share
3 answers

Another thread (and not the main Swing event stream) can invokeAndWait to wait for the Swing event stream to be ready to trigger some action. However, the Swing event flow cannot wait on its own. Therefore, it invokes invokeLater to queue the action for later execution.

+7
source

Not being a Java developer, I think that if invokAndWaitexecuted in an event stream, it effectively blocks itself.

+3
source

invokeAndWait() , . -, invokeLater() . , . , invokeAndWait() : , . , invokeAndWait() Swing , - . invokeLater().

, invokeAndWait() . , invokeAndWait(), , . , , , , - . , invokeAndWait() , java.lang.Error. ( Error ); , .

The third difference is that the invokeAndWait () method can throw an InterruptedException if the thread is interrupted before the event stream starts the target, or InvocationTargetException if the Runnable object throws an exception or an error at run time.

-IvarD

+2
source

All Articles