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
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user