GridBagLayout

The GridBagLayout provides a grid for components like GridLayout, but allows a single component element to occupy multiple cells of the grid. Each GridBagLayout uses a rectangular grid of cells, just like a GridLayout. However the cells are determined and shaped by the components placed in them rather than the components being shaped to fit the cells.

According to Peter van der Linden:

GridBagLayout was contributed to Javasoft by a programmer who wanted to support the Java effort. It was intended as a proof that the AWT offered enough features for programmers to write their own layout managers. It wasn't designed with human factors and ease of use in mind. If it bothers you (it bothers me) then just don't use it. Create your GUI on several panels and use the other layout managers as appropriate to get the exact effect you want. JavaSoft's AWT team project leader has said that eventually another layout manager will be added that does similar things to GBL, but is more intuitive. Bottom line: nobody has to waste any effort on GBL, there are better alternatives available.


Previous | Next | Top | Cafe au Lait

Copyright 1997 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified March 24, 1997