Home > Articles > Programming > User Interface (UI)

GridBagLayout Versus FormLayout

  • Print
  • + Share This
In the conclusion of his three-part series, Jeff Friesen compares GridBagLayout to JGoodies FormLayout, another popular Java layout manager. Both layout managers offer advantages and disadvantages, with the scale tipping toward FormLayout as the more flexible layout manager.
Be sure to start with Part 1 and Part 2 of this three part series.
Like this article? We recommend

In the previous articles in this series, I introduced you to GridBagLayout’s classes, demonstrated various constraints combinations, and showed how to build practical layouts with GridBagLayout. Because GridBagLayout may not do everything you need, in the way you need to do it, this article compares GridBagLayout to another popular layout manager: JGoodies FormLayout.

Downloading and Installing JGoodies FormLayout

GridBagLayout’s complexity has led to the creation of alternative layout managers. These layout managers share GridBagLayout’s flexibility while overcoming its complexity. One of these alternative layout managers is FormLayout, the cornerstone of Karsten Lentzsch’s JGoodies Forms library. You can freely download and incorporate this library into your commercial products, provided that you abide by the terms of its BSD open source license.

Download this library by pointing your web browser to and selecting forms-1_0_7.zip from Karsten’s Downloads :: Libraries web page. After downloading and unzipping this distribution file, I recommend that you move the unzipped forms-1.0.7 subdirectory to the root directory on drive c:\, which results in c:\forms-1.0.7 as the home directory for your copy of the Forms library.

The c:\forms-1.0.7 directory contains a forms-1.0.7.jar file. After establishing the home directory, add this JAR file to your CLASSPATH to make FormLayout accessible to your code. Specify the following to add this JAR file to the Windows 98 SE CLASSPATH, for example:

set classpath=%classpath%;c:\forms-1.0.7\forms-1.0.7.jar

If you’re using a different version of Windows, or a non-Windows operating system, study your OS documentation to find out how to set this environment variable.

  • + Share This
  • 🔖 Save To Your Account