12.3 GridLayout



A GridLayout allows you to build a table of components, and as you add them they are placed left-to-right and top-to-bottom in the grid. In the constructor you specify the number of rows and columns that you need and these are laid out in equal proportions.

Case Study: GridLayout1.java


In this case there are 21 slots but only 20 buttons. The last slot is left empty; no "balancing" goes on with a GridLayout.


Next Page