9.1.1 Synchronous Calls - Reference Documentation
Authors: Andres Almiray
Version: 1.2.0
9.1.1 Synchronous Calls
Synchronous calls inside the EDT can be achieved by calling theedt{}
method. This method is smarter than plain SwingUtilities.invokeAndWait
as it won't throw an exception if called inside the EDT, on the contrary, it will simply call the block of code it was given.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 edt { // 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 edt { // back inside the EDT model.result = … } } }