Описание тега invokeandwait

A method provided by the SwingUtilities class in Java that executes synchronously code on the AWT event dispatching thread in order to correctly manipulate UI elements.

SwingUtilities.invokeAndWait is a method provided by the Swing Library in Java in order to execute code on the AWT dispatching thread in a synchronous fashion. As in the majority of graphical toolkits, an arbitrary thread is not allowed to update directly the UI but should asks the UI thread to execute it on its behalf.

Similar constructs exists in other UI toolkits (for example, in.NET there are Invoke/InvokeRequired methods in Windows Forms and the Dispatcher object in WPF).

This tag should be used to emphasize that invokeLater is used in the code, thus ruling out concurrency issues on the UI.

Related tags: invokelater

Additional resources:

  • The Java Tutorial has a chapter on invokeLater and invokeAndWait.