Where can I find a description of Swing as a single-threaded model in the JavaDoc?

萝らか妹 提交于 2019-12-12 00:34:10

问题


It's widely known that Swing uses a single Event Dispatch Thread. Where can I find a statement that says this in the JavaDoc?

I can find a blog entry from Sun that says this:

This analysis culminated in one of the design reviews for Swing in 1997, when we reviewed the state of play in AWT, and the overall industry experience, and we accepted the Swing team's recommendation that Swing should support only very limited multi-threading. With a few narrow exceptions all GUI toolkit work should occur on the event processing thread. Random threads should not try to directly manipulate the GUI state.

-- http://weblogs.java.net/blog/kgh/archive/2004/10/multithreaded_t.html

But since blog entries are not documentation, I don't want to rely on what might simply be an implementation detail.


回答1:


In the swing package javadoc, which is linked from the javadoc of every Swing component. See for example the doc of JButton, which says:

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.



来源:https://stackoverflow.com/questions/13873198/where-can-i-find-a-description-of-swing-as-a-single-threaded-model-in-the-javado

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