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

 equalsConstraints.gridwidth = 1;
 equalsConstraints.gridheight = 2;

Previous | Next | Top | Cafe au Lait

Copyright 1997, 2002 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified November 16, 2002