Skip to main content

Swing Application Framework Architecture

Posted by joconner on June 7, 2007 at 1:28 PM PDT

architecture.gif

Two singleton classes help you manage your application: ApplicationContext and Application. The Application and ApplicationContext objects have a 1:1 relationship.

The ApplicationContext provides services to the Application. Those services include the following:

  • localizable resource management
  • task services and monitoring
  • event action management
  • session state storage
  • basic local data storage

All framework applications must subclass either the Application class or its SingleFrameApplication subclass. The Application class provides life cycle methods for launching the application, starting the user interface (UI), and shutting down.

The SingleFrameApplication adds a default main GUI frame, retrieves and injects default resources, and uses the ApplicationContext to save restore simple session state. Both superclasses provide an ApplicationContext, but the SingleFrameApplication class provides additional default behaviors that utilize the context.

You probably will not use Application as your superclass. Most likely, the SingleFrameApplication class provides the default behavior you need. In the future, other subclasses should be available to handle multi-frame applications as well. Regardless of the superclass, your application will use its ApplicationContext singleton to access most services provided by the framework.

To check out the progress on JSR 296, download the framework from its Swing Application Framework Project home on java.net.

Related Topics >>