Описание тега invokelater
A method provided by the SwingUtilities class in Java that executes asynchronously code on the AWT event dispatching thread in order to correctly manipulate UI elements.
SwingUtilities.invokeLater
is a method provided by the Swing Library in Java in order to execute code on the AWT dispatching thread in an asynchronous 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: invokeandwait
Additional resources:
- The Java Tutorial has a chapter on
invokeLater
andinvokeAndWait
.