问题
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