fill

The GridBagConstraints fill field determines whether and how a component is resized if the component's display area is larger than the component itself. The mnemonic constants you use to set this variable are

GridBagConstraints.NONE
Don't resize the component
GridBagConstraints.HORIZONTAL
Make the component wide enough to fill the display area, but don't change its height.
GridBagConstraints.VERTICAL
Make the component tall enough to fill its display area, but don't change its width.
GridBagConstraints.BOTH
Resize the component enough to completely fill its display area both vertically and horizontally.

For the display area of the calculator screen use

displayConstraints.fill = GridBagConstraints.HORIZONTAL;

because you'd like the screen to show as many digits as it can.


Previous | Next | Top | Cafe au Lait

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