Sun: A Swing Architecture Overview

Sun: A Swing Architecture Overview

This was enlightening. Swing's MVC concept is indeed different than traditional (or "pure", but I don't want to sound too religious ;-)) MVC, and it was a design decision.

Each component has an associated type of "Model" object that acts as an intermediary between the view of the component and your domain data/object model.

Unfortunately, and maybe not surprisingly, the code generated by NetBeans (I hesitate to say "by Java IDEs" because I haven't used all of them!) is very weak in this regard, and basically undocumented (if I can't find docs after an hour of searching they either don't exist or are so bad nobody has ever linked to them). Doing it properly appears to require a huge amount of code, or, the functionality is in the IDE but obscured by a lack of documentation, tooltips and help info.

Oh, and my other pet peeve is that the Java Beans API is not baked into java.lang.Object. One has to write a LOT of code in domain classes to comply with the Beans architecture (read: bound properties) to have a hope of playing nice with Swing's component/model architecture. NSObject/KVC/KVO/Cocoa Bindings where are you!?!?!

Written on March 11, 2005