public static void invokeLater(Runnable event, Component component)
throws InvocationTargetException {
final InvocationEvent invocationEvent =
new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(), event);
if (component != null) {
final AppContext appContext = SunToolkit.targetToAppContext(component);
SunToolkit.postEvent(appContext, invocationEvent);
// 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock
SunToolkit.flushPendingEvents(appContext);
} else {
// This should be the equivalent to EventQueue.invokeAndWait
((LWCToolkit)Toolkit.getDefaultToolkit()).getSystemEventQueueForInvokeAndWait().postEvent(invocationEvent);
}
final Throwable eventException = invocationEvent.getException();
if (eventException == null) return;
if (eventException instanceof UndeclaredThrowableException) {
throw new InvocationTargetException(((UndeclaredThrowableException)eventException).getUndeclaredThrowable());
}
throw new InvocationTargetException(eventException);
}
LWCToolkit.java 文件源码
java
阅读 33
收藏 0
点赞 0
评论 0
项目:jdk8u-jdk
作者:
评论列表
文章目录