gridwidth and gridheight

The gridwidth and gridheight fields specify the number of cells in a row (gridwidth) or column (gridheight) in the Component's display area. The mnemonic constant GridBagConstraints.REMAINDER specifies that the Component should use all remaining cells in its row (for gridwidth) or column (for gridheight). The mnemonic constant GridBagConstraints.RELATIVE specifies that the Component should fill all but the last cell in its row (gridwidth) or column (gridheight).

The calculator's display is four cells wide and one cell high so it's set like this

    displayConstraints.gridwidth = 4;
    displayConstraints.gridheight = 1;
The equals key is two cells high and one wide so it's set like this

    displayConstraints.gridwidth = 1;
    displayConstraints.gridheight = 2;

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