EventQueue.invokeLater(new Runnable())(二)

2014-11-24 09:09:47 · 作者: · 浏览: 2
--------------------------------------------------------------------------------
push
public void push(EventQueue newEventQueue)用指定的事件队列替换现有的 EventQueue。任何挂起的事件都被传输到 EventQueue 以备处理。
参数:
newEventQueue - 要使用的 EventQueue(或其子类的)的实例
抛出:
NullPointerException - 如果 newEventQueue 为 null
从以下版本开始:
1.2
另请参见:
pop()
--------------------------------------------------------------------------------
pop
protected void pop()
throws EmptyStackException停止使用此 EventQueue 指派事件。任何挂起的事件都被传输到以前的 EventQueue 以备处理。
警告:为了避免死锁,不要在子类中将该方法声明为 synchronized。
抛出:
EmptyStackException - 如果以前没有对该 EventQueue 执行 push 操作
从以下版本开始:
1.2
另请参见:
push(java.awt.EventQueue)
--------------------------------------------------------------------------------
isDispatchThread
public static boolean isDispatchThread()如果正在调用的线程是当前 AWT EventQueue 的指派线程,则返回 true。使用此调用确保给定的任务正在当前 AWT EventDispatchThread 上执行(或没有执行)。
返回:
如果给定的任务正在当前 AWT EventQueue 的指派线程上运行,则返回 true。
从以下版本开始:
1.2
--------------------------------------------------------------------------------
invokeLater
public static void invokeLater(Runnable runnable)导致 runnable 的 run 方法在 the system EventQueue 的指派线程中被调用。
参数:
runnable - Runnable 对象,其 run 方法应该在 EventQueue 上同步执行
从以下版本开始:
1.2
另请参见:
invokeAndWait(java.lang.Runnable)
--------------------------------------------------------------------------------
invokeAndWait
public static void invokeAndWait(Runnable runnable)
throws InterruptedException,
InvocationTargetException导致 runnable 的 run 方法在 the system EventQueue 的指派线程中被调用。在所有挂起事件被处理后才发生。在这发生之前调用被阻塞。如果从事件指派线程进行调用,则该方法将抛出 Error。