Java News from Thursday, July 6, 2006

Sun has submitted JSR-296, Swing Application Framework, to the Java Community Process. According to the JSR,

Well written Swing applications tend to have the same core elements for startup and shutdown, and for managing resources, actions, and session state. New applications create all of these core elements from scratch. Java SE does not provide any support for structuring applications, and this often leaves new developers feeling a bit adrift, particularly when they're contemplating building an application whose scale goes well beyond the examples provided in the SE documentation.

This specification will (finally) fill that void by defining the basic structure of a Swing application. It will define a small set of extensible classes or "framework" that define infrastructure that's common to most desktop applications:

The essential application lifecyle, startup and shutdown, with well defined milestones so that applications can insert startup or shutdown work when the application has reached a well known state.

Support for loading localized resources. Desktop applications deal with a set of common resource types beyond message strings, notably images, colors, and fonts. Resources can also be specific to the platform or to the application's "branding".

Persistent session state. Most applications need a way to persist things like top level window geometry across sessions. Automatic support for such common cases as well as for loading and storing arbitrary session data at startup and shutdown time, would be useful in most Swing applications.

Actions define the behavior of Swing application from the user's perspective. In all but the smallest applications, it's useful to be able to loosely couple an Action's (localized, branded, etc) presentation from its implementation. Action implementations often must perform some work asychronously wrt to the Swing event dispatching thread. The application framework would provide support for doing so and for providing GUI feedback while significant work is being done on the user's behalf.