src/Pure/General/swing.scala
author wenzelm
Wed, 28 Jan 2009 11:36:45 +0100
changeset 29649 8b0c1397868e
parent 29202 2454172eddae
child 29777 f3284860004c
permissions -rw-r--r--
more robust treatment of SwingUtilities.isEventDispatchThread;

/*  Title:      Pure/General/swing.scala
    Author:     Makarius

Swing utilities.
*/

package isabelle

import javax.swing.SwingUtilities

object Swing
{
  def now(body: => Unit) {
    if (SwingUtilities.isEventDispatchThread) body
    else SwingUtilities.invokeAndWait(new Runnable { def run = body })
  }

  def later(body: => Unit) {
    if (SwingUtilities.isEventDispatchThread) body
    else SwingUtilities.invokeLater(new Runnable { def run = body })
  }
}