GridLayout
specifies the number of rows and columns
into which components will be placed.
The applet is broken up into a table of equal sized cells.
GridLayout
is useful when you want to place a number of similarly sized objects. It's great for putting together lists of checkboxes and radio buttons as you did in the Ingredients
applet. Below is a modified version that sets aside eight rows and one column. This gives one row for each Checkbox
. Compare the applet below to the one from Week 6 to see how much nicer everything looks with proper use of a GridLayout
.