Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在摇摆中,我们有:
boolean SwingUtilities.isEventDispatchThread()
如果从 swing 事件调度线程调用,则返回 true。
javafx中有类似的东西吗?
是的,您可以通过以下方式检查您是否在 FX 线程中:
Platform.isFxApplicationThread();
请注意,许多 UI 交互方法在 FX 线程外调用时会抛出异常。