src/Pure/General/swing.scala
changeset 29777 f3284860004c
parent 29649 8b0c1397868e
--- a/src/Pure/General/swing.scala	Sat Feb 21 18:06:17 2009 +0100
+++ b/src/Pure/General/swing.scala	Sun Feb 22 20:37:18 2009 +0100
@@ -10,9 +10,11 @@
 
 object Swing
 {
-  def now(body: => Unit) {
-    if (SwingUtilities.isEventDispatchThread) body
-    else SwingUtilities.invokeAndWait(new Runnable { def run = body })
+  def now[A](body: => A): A = {
+    var result: Option[A] = None
+    if (SwingUtilities.isEventDispatchThread) { result = Some(body) }
+    else SwingUtilities.invokeAndWait(new Runnable { def run = { result = Some(body) } })
+    result.get
   }
 
   def later(body: => Unit) {