在JavaDoc的哪里可以找到有关Swing作为单线程模型的描述? [英] Where can I find a description of Swing as a single-threaded model in the JavaDoc?

查看:43
本文介绍了在JavaDoc的哪里可以找到有关Swing作为单线程模型的描述?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

众所周知,Swing使用单个事件调度线程.我在哪里可以找到JavaDoc中这样的语句?

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

我可以从Sun找到一个博客条目,内容如下:

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

此分析最终完成了Swing in的设计审查之一 1997年,我们回顾了AWT的发展状况,以及总体 行业经验,我们接受了Swing团队的建议 Swing应该仅支持非常有限的多线程.用 少数例外,所有GUI工具包的工作都应在事件中发生 处理线程.随机线程不应该尝试直接 操纵GUI状态.

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.

推荐答案

JButton的文档,说:

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

警告:摆动不是线程安全的.有关更多信息,请参见Swing的线程策略.

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

这篇关于在JavaDoc的哪里可以找到有关Swing作为单线程模型的描述?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆