Java API“如果不在EDT上运行,则在EDT上运行” [英] Java API "Run on EDT if not on EDT"
本文介绍了Java API“如果不在EDT上运行,则在EDT上运行”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
关于我的一些重复代码只是一个沉思:
Just a musing about some repetitive code I have:
Runnable run = new Runnable() {
@Override
public void run() {
// Some EDT code
}
};
if (!EventQueue.isDispatchThread()) {
SwingUtilities.invokeAndWait(run);
} else {
run.run();
}
这不是非常讨厌,但似乎会有一些专有功能为你检查这个,虽然我还没找到。
It's not terribly annoying, but it seems like there would be some proprietary function that checks this for you, although I haven't found it.
推荐答案
好像会有是一些为你检查的专有功能
it seems like there would be some proprietary function that checks this for you
没有。
这篇关于Java API“如果不在EDT上运行,则在EDT上运行”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文