Class 1, Part 2 |
Intro to Java 30-IT-396 |
|
GridLayout
-
Unlike FlowLayout, GridLayout does not respect the preferred size of the
components. It places all of the components in a grid, and each component
consumes the entire cell it is in. There is only one component per
cell.
-
You can specify the number of columns and rows in a Grid. Interestingly,
Java will only use one of them, and count the components to math out the
remainder.
-
This example has three columns and three rows:
-
Note what happens when I resize one component.
-
Even though I only changed the size of jButton7, the GridLayout resized
all components to the size of that button. Thus, all components assume
the size of the largest component.
Perhaps the most confusing at all, the BorderLayout
Created by: Brandan
Jones January 4, 2002