Java Reference
In-Depth Information
manager takes advantage of all available space in both directions. Figure 10-7 demonstrates
VERTICAL
,
HORIZONTAL
, and
NONE
values (generated by changing the
GridBagConstraints.BOTH
settings in Listing 10-1).
Figure 10-7.
GridBagLayout with different fill values
Grid Positioning
The
gridx
and
gridy
variables specify the grid position where this component would be placed.
(0, 0) specifies the cell at the origin of the screen. The
gridwidth
and
gridheight
variables
specify the number of rows (
gridwidth
) and columns (
gridheight
) a particular component
occupies. Table 10-3 shows the
gridx
,
gridy
,
gridwidth
, and
gridheight
values for the example
shown earlier in Figure 10-5.