是java.util.Observable在任何地方使用? [英] Is java.util.Observable used anywhere?
问题描述
正在和一位同事聊聊Javas图书馆的设计。我提到我总是觉得很有趣的是AWT / Swing类调用它实际上在UI小部件上提供了一个Observable接口实际上被称为监听器。
Was chatting to a colleague about the design of Javas libraries. I mentioned I'd always found it funny that the AWT/Swing classes called that essentially provide an Observable interface on a UI widget were actually called "listeners".
然后他通过指出与 java.util.Observer 和 java.util.Observable ,自JDK 1.0以来一直存在。我以前从未听说过它们。
Whereupon he floored me by pointing out that there would have been a name clash with java.util.Observer and java.util.Observable, which have been around since JDK 1.0. I'd never heard of them before.
JavaDocs和google / googlecode 没有提出太多,所以有人知道它们是否被用于某处在JDK?他们似乎没有收到任何通用的爱,所以可能他们并不受欢迎。有人发现它们有用吗?
There are no usages listed in the JavaDocs and google/googlecode don't come up with much, so does anyone know if they are used somewhere in the JDK? They don't seem to have received any Generic love, so presumably they're not "popular". Has anyone found them useful?
推荐答案
Observer
和 Observable
仍然用在很多Eclipse向导代码中,用于检测输入框中的内容何时发生更改,因此可以更新向导本身。我不得不处理一些这些东西,根据我们自己的需要改变它。:)
Observer
and Observable
are still used in a lot of Eclipse wizard code for detecting when the stuff in input boxes changes, so the wizard itself can be updated. I've had to work with some of this stuff, changing it for our own needs.. :)
这篇关于是java.util.Observable在任何地方使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!