Consider JGoodies Forms for layouts

One of the painful aspects of Swing is layouts. The layouts provided by the JDK are inadequate in many practical cases. The GridBagLayout class is particularly frustrating. Although its basic idea is sound, the details of its use are difficult and frustrating to master. As well, using GridBagLayout usually creates code repetition, which needs additional effort to reduce or eliminate.

As an alternative, you may consider the excellent JGoodies Forms tool. It takes the interesting approach of defining a small mini-language for defining its layouts (an example of a Domain Specific Language). While at first somewhat cryptic, this mini-language is quite effective in practice. The end result is almost always pleasing to the eye. Another nice feature is its debug mode, whereby a colored grid is laid over the form, so you may easily verify the x-y coordinates of its cells.

See Also :
Layout Managers
Would you use this technique?
Yes   No   Undecided   
© 2014 Hirondelle Systems | Source Code | Contact | License | RSS
Individual code snippets can be used under this BSD license - Last updated on September 21, 2013.
Over 2,000,000 unique IPs last year - Built with WEB4J.
- In Memoriam : Bill Dirani -