Notifications in a Java/Swing Application

Possible Uses

Some user interface possibilities include:

User feedback: Some aspect of the display is merely providing a visual feedback hint as to the state of some option (secure mode, off-line, and so forth). Rather than pushing the change in some setting to the feedback hint(s) directly, just let them be notified.

Immediate preference change: If the behavior is desired, a preference change made by the user can trigger business logic to process that preference change immediately, rather than after the user "OK"s the entire preference panel.

... however, do not discount the ability to process non–user-interface state changes:

File(s) loaded from disk

User is now available

Network resource is no longer available

(Solution to your big problem here)

Conclusion

This was a quick illustration of how a you can arrange for application-wide notification of certain events. Although the demo above was kept small, more complex applications might drag in multiple notification objects and also intermix their use with the one-to-one style application controllers covered previously. Both exist as two sides of the same coin: They give you, the application designer, the ability to reduce the amount and degree of coupling between areas of your application.