Gola (GUI Objects Layout Assistant) is an application that allows you to graphically
layout components of a GUI for Java Swing/AWT and automatically
generate code for use with the
PageLayout layout manager. The code generated by Gola is much more readable than the GUI code
generated by most other such GUI builders, and is, therefore, very easy to modify and maintain.
The current edition of Gola is available as a freeware.
The latest version of Gola available for download is 1.22, released on Sept 6, 2008.
You need Java SE 1.6 or later to run Gola.
- Download gola1.22.zip and unzip it into a directory of your choice.
- Download pagelayout1.16.zip and unzip it into the same directory.
- Use pagelayout1.16.jar and gola1.22.jar extracted in the previous step to start Gola:
- java -classpath gola1.22.jar;pagelayout1.16.jar gola.Builder
- You can familiarize yourself with the system by opening any of the example files in the golaexamples directory of the distribution. In particular, you may want to go through the steps outlined in this example.
The Gola GUI itself is based upon the PageLayout layout manager. The GUI is almost WYSWYG, but not completely so. For example, here are two images of a GUI: the first one displays the GUI as it appears when you build it (i.e., in the design mode), and the one below is the image of the GUI in the preview mode.
The main difference is the appearance of identifier tabs at the (a) top left corner of a grid, (b) bottom of a column with an arrowhead pointing downward, and (c) at the right edge of a row with an arrowhead pointing to the right. These extra areas are added to facilitate the selection of these elements during design. These additional spaces are removed in the generated code.
Gola forces you to layout components in nested rows, columns or grids. As a result, its not possible to insert a component at any arbitrary point on the drawing area but only at certain insertion points which are displayed as thin black rectangles as you move the cursor over the rows, columns or grids that you have placed in your GUI .
Every component that is laid out is given a name that is used as the identifier for it in the generated code. This name can be modified in the Property Panel, which allows you to do minimal editing of some of the basic properties of the laid out components.
Every row, column, or grid that is placed in the GUI during the design phase is actually a JPanel object. However, unless you decorate the panels by a border or a border title, these panels are not used in the generated class, consistent with one of the main features of the PageLayout layout manager.
When you save the GUI that you have constructed, its contents are saved in an XML file (with the extension gola), and, simultaneously, a Java file is generated. The Java file contains a main method, and so the file can be immediatley compiled and tested. However, to use the this code in a real application, you will have to extend the class defined in the generated file, and typically override the decorateComponents method of the generated class to add event listeners to the various components.
The properties of various components that are not accessible for editing in the PropertyPanel may also be modified in the decorateComponent method of the generated class.
The gola file generated during a session can be opened and re-edited in a later session.
To use the generated class in an application, you neither need the classes in the gola jar file of the distribution, nor the XML file of the GUI (with the .gola extension). Only the pagelayout jar is required.
The method void createGUI(Container) of the generated class can be called to construct the GUI that you build using Gola in any container (for example, a JPanel object, or the container obtained by the getContentPane method of an object of the class JFrame).
For the example dialog Gola generated the following code. (Only the layout related code is shown in both the cases.)
Netbeans 6.0 rightly admonishes the user not to look at the code, shown below, that it generates for essentially the same dialog.