Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. What I want to ask is what is the aim of Dialog not derived from Component, but RichWindow, as compared to the Swing library?

like image 247
thlim Avatar asked Jul 12 '11 05:07

thlim


1 Answers

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:

AWT/Swing window hierarchy

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:

scala.swing hierarchy

[...]

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.

like image 167
Eugene Yokota Avatar answered Sep 21 '22 23:09

Eugene Yokota