Skip to main content

The Swing Application (Un)Framework

Posted by joconner on June 3, 2007 at 11:07 PM PDT

The Swing Application Framework (JSR 296) is hardly a framework at all, not in the typical sense anyway. Frameworks are often big, heavy-structure libraries that force a specific application design. Although they may pay great dividends if you have the patience to master them, frameworks often require a huge commitment because of their complexity. Remember Microsoft's MFC framework or Borland's OWL? Both are/were GUI frameworks that overflowed into lots of other application areas too. The Swing Application Framework isn't a GUI framework in that sense...it doesn't wrap up existing Swing components in new components or introduce a new mechanism for event routing. And it definitely doesn't take a long time to learn or use.

The framework seems to acknowledge that app developers do need help creating Swing applications, but that help is just a nudge in the right direction and includes only very basic APIs that encourage best practices developing GUI apps. That's my impression anyway...the framework is just a little help to get me started off on the right foot as I develop small to medium sized Swing applications.

The existing framework helps in a few common areas, areas that are common to every Swing app:

  • life cycle
  • event and action handling
  • thread management
  • resources
  • session persistence

Getting started with the framework is simple enough. Download the framework APIs from the project site. Put the library in your compiler and runtime classpath to access those apis. Using external libraries is easy, particularly if you use any of the typical IDEs, which help you quickly add external libraries to projects. I just happen to use NetBeans 5.5.1, but Eclipse can help you too.

I'll try to followup with additional blogs over the next few days and weeks. I'll describe the architecture and the major API areas listed above. I hope you come to some of the same conclusions I've made. The Swing Application Framework might be the lightest, easiest to use "framework" I've ever tinkered with. Listening to its creators, I believe they intended it to be just that way.

Next stop: framework architecture. Stay tuned.

Disclaimer: Blog posts do not express the opinions of Sun Microsystems or any of its representatives. I do not represent Sun in my blog posts.

Related Topics >>