问题描述
这主要是关于我的问题,但我不明白为什么以及它的用途。我正在设计一个摇摆gui,我不想错过Swing Utilities可能提供的任何东西。也有人可以解释 invokeLater
方法的作用及其工作原理。
This is mainly in regards to my question here, but I don't understand why Swing Utilities is needed and what it is used for. I'm designing a swing gui and I don't wanna miss out on anything that Swing Utilities might offer. Also could someone could explain what the invokeLater
method does and how it works.
推荐答案
如中所述, SwingUtilities
是Swing实用程序方法的集合。在这种情况下,需要确保在Event Dispatch Thread中创建/修改Swing组件,或者 EDT
。另外,如, invokeLater
。
As stated in the API, SwingUtilities
is a collection of utility methods for Swing. In this case, it is needed to ensure that Swing components are created/modified in the Event Dispatch Thread, or EDT
. Also, as stated in the API, invokeLater
is used when an application thread needs to update the GUI.
您可能还想阅读。另外,。
You might also want to read up on Concurrency in Swing. Also, a More In-Depth Explanation of invokeLater.
这篇关于为什么我需要Swing Utilities以及如何使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!