--- a/src/Pure/General/swing.scala Wed Jan 28 10:43:31 2009 +0100
+++ b/src/Pure/General/swing.scala Wed Jan 28 11:36:45 2009 +0100
@@ -10,9 +10,13 @@
object Swing
{
- def now(body: => Unit) =
- SwingUtilities.invokeAndWait(new Runnable { def run = body })
+ def now(body: => Unit) {
+ if (SwingUtilities.isEventDispatchThread) body
+ else SwingUtilities.invokeAndWait(new Runnable { def run = body })
+ }
- def later(body: => Unit) =
- SwingUtilities.invokeLater(new Runnable { def run = body })
+ def later(body: => Unit) {
+ if (SwingUtilities.isEventDispatchThread) body
+ else SwingUtilities.invokeLater(new Runnable { def run = body })
+ }
}