Why do I need Swing Utilities and how do I use it?

亡梦爱人 提交于 2019-12-02 00:20:16

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/6343716/why-do-i-need-swing-utilities-and-how-do-i-use-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!