I recently joined a project that has switched from GridBagLayout to JGoodies’ FormLayout as a standard. I’m happy about about this decision, because I have been using FormLayout for over a year. However, one of my fellow developers is very skeptical of FormLayout, believing that GridBagLayout can do anything we need to get done. Additionally, he really doesn’t like using unsafe Strings to declare columns and row in the FormLayout constructors (i.e. new FormLayout(“4dlu, p:g, 2dlu, p:g, 4dlu”, “p, 4dlu, p, 2dlu, p, 2dlu, p, 4dlu, p”)). I’m trying to convince him that FormLayout is a superior LayoutManager, making Swing GUI development more powerful and easier. Am I barking up the wrong tree, or is there something more I can use in my argument?
Part of the problem in convincing him is the nature of our application. It has a fixed width and a scrollpane for the height, so much of the complexity of a LayoutManager is lost; we don’t need to plan for resizing, changing resolution, or font. We also have only one main pane, so keeping the layout stable from one panel to another is irrelevant. Similarly, our customers tend not to care about making sure that columns have the same width without forcing the components to a set size making sure lines have the same height, and aligning font baselines. So these advantages of FormLayout are lost.
FormLayout still takes a lot fewer lines of code than GridBagLayout does, but is that enough of an advantage by itself? Is it worth using FormLayout if you have a fixed-size workspace?