From 7a73ee5fb1eee2d5e7c1fd9cd8de26a9975f429e Mon Sep 17 00:00:00 2001 From: ray Date: Mon, 25 Aug 2008 08:06:09 +0000 Subject: [PATCH] Define a handy-dandy public static RunQueue implementation that posts Runnables to the AWT dispatch thread. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1718 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../src/java/com/samskivert/util/RunQueue.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/projects/samskivert/src/java/com/samskivert/util/RunQueue.java b/projects/samskivert/src/java/com/samskivert/util/RunQueue.java index 451b96c3..66c9031c 100644 --- a/projects/samskivert/src/java/com/samskivert/util/RunQueue.java +++ b/projects/samskivert/src/java/com/samskivert/util/RunQueue.java @@ -3,11 +3,29 @@ package com.samskivert.util; +import java.awt.EventQueue; + /** * An interface for a service that queues up execution of Runnables. */ public interface RunQueue { + /** + * A useful RunQueue that uses the AWT dispatch thread. + */ + public static final RunQueue AWT = new RunQueue() + { + public void postRunnable (Runnable r) + { + return EventQueue.invokeLater(r); + } + + public boolean isDispatchThread () + { + return EventQueue.isDispatchThread(); + } + }; + /** * Post the specified Runnable to be run on the RunQueue. */