9.1.2 Asynchronous Calls - Reference Documentation
Authors: Andres Almiray
Version: 1.2.0
9.1.2 Asynchronous Calls
Asynchronous calls inside the EDT can be made by calling thedoLater{}
method. This method simply posts a new event to the underlying EventQueue using SwingUtilities.invokeLater
, meaning you spare a few characters and a class import.Example:class MyController { def model def action1 = { // will be invoked inside the EDT by default (pre 0.9.2) def value = model.value Thread.start { // do some calculations doLater { // back inside the EDT model.result = … } } } def action2 = { // will be invoked outside of the EDT by default (post 0.9.2) def value = model.value // do some calculations doLater { // back inside the EDT model.result = … } } }