src/Pure/General/swing.scala
changeset 29649 8b0c1397868e
parent 29202 2454172eddae
child 29777 f3284860004c
equal deleted inserted replaced
29648:ead544f3d6a1 29649:8b0c1397868e
     8 
     8 
     9 import javax.swing.SwingUtilities
     9 import javax.swing.SwingUtilities
    10 
    10 
    11 object Swing
    11 object Swing
    12 {
    12 {
    13   def now(body: => Unit) =
    13   def now(body: => Unit) {
    14     SwingUtilities.invokeAndWait(new Runnable { def run = body })
    14     if (SwingUtilities.isEventDispatchThread) body
       
    15     else SwingUtilities.invokeAndWait(new Runnable { def run = body })
       
    16   }
    15 
    17 
    16   def later(body: => Unit) =
    18   def later(body: => Unit) {
    17     SwingUtilities.invokeLater(new Runnable { def run = body })
    19     if (SwingUtilities.isEventDispatchThread) body
       
    20     else SwingUtilities.invokeLater(new Runnable { def run = body })
       
    21   }
    18 }
    22 }