Welcome!

AJAX & REA Authors: John Funnell, Bob Little, Kevin Hoffman, Maureen O'Gara, Onkar Singh

Related Topics: AJAX & REA, Java

AJAX & REA: Article

Developing Rich Client Applications Using Swing

Part 1 - A comparison of available solutions

There are many Swing-based suites of graphics components, some are open source solutions and others are commercial solutions. The most complete libraries are listed below in alphabetical order:

  • JGoodies Swing Suite: A commercial solution that includes utility classes for help support, a progress bar, some look 'n feels, login dialogs, welcome frame, license agreement frame, preferences frame, tips frame, about frame, some utility classes for resources management, splash screen, and setup frame.
  • JIDE Suite: One of the most complete suites of Swing-based components, JIDE suite is composed of several component distributions. The JIDE suite does not include input controls such as numeric field, currency field or text field with advanced properties (trim, padding, min/max value checking, mandatory checking, value-length checking, data-type checking). However, this limitation is not necessarily a real limit since Swing + JIDE components can be linked to a data-binding mechanism that can enhance them, such as Beans Binding. IDE distributions are not free, except for JIDE Common Layer.
  • JMatter:This framework can be applied to develop two-tier client/server applications: the client tier is built using Swing-based components; the server tier is based on Hibernate's ORM tool. JMatter provides a set of graphics components that support data binding with the data model (constructed above a database). The data model definition is simplified using the Project Builder wizard included with JMatter; this model definition can be carried out along with GUI construction. This framework was released with a dual licence: GPL for open source projects and a commercial licence for non-free applications. JMatter is not a real suite of Swing-based components. Rather a CASE tool is used for the rapid development of desktop applications. As such it allows a GUI construction bound by framework rules. These constraints could be too restrictive for applications with a highly customized front end.
  • Kiwi: This suite of Swing-based graphics components was released under a dual license: GPL for open source projects and a commercial license for non-free projects. It includes tree+grid, calendar, dialogs, chart and diagram components, I/O management utility classes, data sources for grids, tree, list, renderers and editors for the grid, about dialog, color chooser, image panel, numeric field, splash screen, progress bar, status bar, link button, utility classes for wizard construction, properties editor, log management utility classes, resources manager (internationalization and loaders for images/icons, audio clips, HTML, and Web pages). Kiwi partly supports JavaBeans use. By means of an adapter class it is possible to map a list of JavaBeans to rows in a grid.
  • L2FProd.com Common Components: This open source project is composed of a few components: properties grid, activities panel, toolbar, Outlook-like toolbar, and tips panel.
  • OpenSwing:This open source suite is released under the LGPL and provides a set of advanced Swing-based components: text field, multi-line label, numeric field, currency field, calendar, three-state checkbox, list with checkboxes, tree, tree with checkbox, tree+grid, gantt diagram, code selection within a grid, code selection using a tree, code selection using tree+grid, tip panel, wizard panes, image panel, progress bar, licence agreement panel, link, alert window, properties grid, combo-box, multi-column combo-box, list, multi-column list, and a powerful grid component. It is possible to use a UI designer (that fully supports JavaBeans specifications) to create a grid. It can be used to graphically set a JavaBean to bind to each grid row and, after that, columns can be dropped on the grid (many columns are available, according to data type - integer, decimal, text, date, hour, combo, checkbox, lookup, code selection, etc.) and finally define column properties (value length, mandatory, editability, column sortable/filtrable/exportable/visible, etc.). Grid components operate directly with JavaBeans, one for each row, using an internal data-binding mechanism ready to use. Another useful component is the Form panel that can bind a JavaBean to all input controls added to it. All OpenSwing components can be managed directly from the UI designer of any Java IDE that fully supports the JavaBeans specifications, including a data-binding mechanism embedded in OpenSwing. It makes this solution similar to the one supplied with non-Java IDEs like Visual Basic or Delphi and drastically reduces the amount of code related to the presentation-side logic to write by hand. Examples of such logic include edited code validation, data conversion, data binding, and data retrieval. OpenSwing includes a data-retrieval mechanism that automates the data-retrieval process. For instance, in the case of a grid, this mechanism can produce information about the grid's current state (current block of data, filtering/sorting conditions, etc.) and send it to the data-access layer, both locally and remotely, using a communication protocol, such as HTTP. This suite also includes some utility classes to connect the data-retrieval mechanism embedded in OpenSwing with the most popular server-side tools, Spring, Hibernate, iBatis, Apache Cayenne, and JPA.

A valuable source of free projects is the Java Desktop portal that provides several collections of graphics components and other solutions for desktop applications development, such as the projects ACEMdi, Aloe, and JCalendar; several look 'n feels; and some layout managers. An interesting project included in Java Desktop is SwingLabs, which is oriented to the extension of components in the Swing toolkit, Java2D, and AWT. It includes JDNC, a suite of graphics components with data binding support, data validation, and remote data retrieval; JDIC, enables seamless desktop/Java integration; SwingX, focused both on extensions to existing Swing toolkit components as well as brand new ones; and the Swing Application Framework (JSR-296), focused on providing an infrastructure that's common to most desktop applications - application lifecycle (notably GUI startup and shutdown), support for managing and loading resources (like strings, formatted messages, images, colors, fonts, and other types common to desktop applications), support for defining, managing, and binding Actions, persistent session state (support for automatically and selectively saving the GUI state from one application run to the next).

Considering what we've said here, Swing doesn't address all the issues described above; moreover, a software house can't always provide the missing pieces. It requires skills on many products that are not always available internally, the time to realize some parts are unacceptable, and a big enough budget.

For these reasons it might be a good idea to use IDEs and exploit what these environments offer, perhaps filling in the IDE's features with third-party solutions (like the ones just described), preferably open source libraries with no GPL licence (e.g., LGPL or BSD) that accommodate commercial applications.

Conclusion
In Part 1 of this article, we introduced the rich client concept, possible architectures involved in rich client development, focusing on the Swing toolkit and the main technologies used in enforcing and speeding development based on Swing. In Part 2, we will compare the most popular IDEs that support Swing development and their extensions and make development more productive.

Resources

More Stories By Mauro Carniel

Mauro Carniel is an architect at Tecnoinformatica Group. He has more than 9 years of enterprise software development experience utilizing J2EE-based technologies, including JSP, JSF, Swing, EJB. He started focusing more on GUI-based client/server Java applications since 1998. He has a MSc in Information Technology from University of Udine, Italy.

Comments (1) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
pettevi 10/30/08 08:31:25 AM EDT

Thanks Mauro, don't forget Flamingo Swing component suite (https://flamingo.dev.java.net) or SwingX (https://swingx.dev.java.net) either. Or the other dozen toolkits out there that don't really raise to the same quality level.