本文整理汇总了Java中java.awt.EventQueue.postEvent方法的典型用法代码示例。如果您正苦于以下问题:Java EventQueue.postEvent方法的具体用法?Java EventQueue.postEvent怎么用?Java EventQueue.postEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.EventQueue
的用法示例。
在下文中一共展示了EventQueue.postEvent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invokeAndWaitLowPriority
import java.awt.EventQueue; //导入方法依赖的package包/类
/**
* Similar to {@link EventQueue#invokeAndWait} but posts the event at the same
* priority as paint requests, to avoid bad visual artifacts.
*/
static void invokeAndWaitLowPriority(RWLock m, Runnable r)
throws InterruptedException, InvocationTargetException {
Toolkit t = Toolkit.getDefaultToolkit();
EventQueue q = t.getSystemEventQueue();
Object lock = new PaintPriorityEventLock();
InvocationEvent ev = new PaintPriorityEvent(m, t, r, lock, true);
synchronized (lock) {
q.postEvent(ev);
lock.wait();
}
Exception e = ev.getException();
if (e != null) {
throw new InvocationTargetException(e);
}
}
示例2: invokeLaterLowPriority
import java.awt.EventQueue; //导入方法依赖的package包/类
/**
* Similar to {@link EventQueue#invokeLater} but posts the event at the same
* priority as paint requests, to avoid bad visual artifacts.
*/
static void invokeLaterLowPriority(RWLock m, Runnable r) {
Toolkit t = Toolkit.getDefaultToolkit();
EventQueue q = t.getSystemEventQueue();
q.postEvent(new PaintPriorityEvent(m, t, r, null, false));
}
示例3: run
import java.awt.EventQueue; //导入方法依赖的package包/类
public void run() {
final EventQueue eq = (EventQueue)appContext.get(EVENT_QUEUE_KEY);
if (eq != null) {
eq.postEvent(AWTAutoShutdown.getShutdownEvent());
}
}