开发者

Why Dialog is not a Component in Scala Swing?

This question arises because I want to capture LostFocusEvent from Dialog. Unfortunately, this event is not fired for non Component derived components. W开发者_如何转开发hat I want to ask is what is the aim of Dialog not derived from Component, but RichWindow, as compared to the Swing library?


I think really the best way to get the answer is to contact Ingo Maier directly, but you may be able to deduce the some of the thinking behind from his blog article The scala.swing package in 2.8 and beyond:

Window hierarchy

This is how the Java AWT/Swing window hierarchy looks like:

Why Dialog is not a Component in Scala Swing?

While AWT's Frame and Dialog share the common base class Window, the Swing extensions have no subclass relationship or extend a common interface even though they share common functionality not present in AWT. In an attempt to straighten things up a little, we redesigned the window base hierarchy in scala.swing which now looks as follows:

Why Dialog is not a Component in Scala Swing?

[...]

This design lets us factor common wrapper code into class RichWindow.

So I am guessing that this is a deliberate design by the author stating that Windows are in fact not components in the same way frames and buttons are, and can be dropped on to other containers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜