When a component is smaller than its display area, the
anchor
field specifies where to place it in the grid cell.
The mnemonic constants you use for this purpose are similar to
those used in a BorderLayout
but a little more
specific. They are
GridBagConstraints.CENTER
GridBagConstraints.NORTH
GridBagConstraints.NORTHEAST
GridBagConstraints.EAST
GridBagConstraints.SOUTHEAST
GridBagConstraints.SOUTH
GridBagConstraints.SOUTHWEST
GridBagConstraints.WEST
GridBagConstraints.NORTHWEST
The default is GridBagConstraints.CENTER
. This is not
explicitly set in the calculator applet, because the components are
large enough, relative to their display areas, that it really
doesn't matter where they go and the default of center is fine.