wo years ago, the Swiss business software maker Abacus Research AG
decided to port its complete product line from Borland's Delphi to Java/Swing. The Abacus Delphi development team faced the unenviable task of rewriting hundreds of GUI applications in Swing without the aid of tools like Delphi or Visual Basic. When Abacus Research looked at the few GUI builders available at the time, it found three basic disadvantages:
- Abacus developers found them complicated, in part because they required Swing knowledge in order to create an application. The developers wanted to create forms within minutes without Swing knowledge.
- The tools lacked XY layout managers and the canvas-style interface that VB offered.
- Abacus Research needed the ability to separate the UI forms from the business logic, which the third-party tools that it reviewed did not provide.
With so many applications to rewrite, time constraints, and a large number of seasoned GUI developers who had little experience in Swing, Abacus Research developed a plan to bridge the gap: writing its own Java tool that functioned like Delphi and Visual Basic and making it available to all developers under the GNU General Public License. Its solution would allow the developer to more easily separate the UI design from the rest of the application logic.
Thus was born the Abacus GUI builder (AbaGUIBuilder), an open-source Java GUI builder designed to provide GUI developers with an easy and rapid Java/Swing development tool. Abacus realized early that its application developers do their best work when they can concentrate on the business logic and UI, instead of the technical details of Swing. Thus, its immediate goal became the implementation of a WYSIWYG tool powerful enough to handle any user interface requirement.
Abacus's first decision was to provide an XY layout with object anchoring, similar to Delphi or VB (see Figure 1). The XY layout transforms the JFrame into a canvas where a developer can drop Swing objects from the class palette. In contrast, most Java layouts managers dynamically render screens according to the resolution of the display.
Next, Abacus determined that the AbaGUIBuilder would output jar files instead of "usable or reusable" Java code. It manufactures and compiles an application jar that hides the UI implementation details. In order to run the application jar, a wrapper program with an AbaRenderer object loads the jar and renders it on your desktop. Other noteworthy features include the abilities to create JFreeChart objects visually, import third-party classes into the class palette, and create database applications using JDBC data sources and DB-aware components.
The following sections use a sample application to walk you through an AbaGUIBuilder build, from creating the application and running it to adding event handlers and writing your own wrapper.
|Editor's Note: The author, Mario Castillo, is a member of the Open Abacus team, which develops the AbaGUIBuilder tool. We have selected this article for publication because we believe it to have objective technical merit.