The behaviour of the standard packer is easily explained, and hard to
understand. Widgets are packed with the function
is defined as
The first two constructors are most important here. The PackOptions.html#PackOptions.SideSpecSideSpec specifies where the widget is packed (top, bottom, left, right), and PackOptions.html#PackOptions.FillSpecFillSpec specifies in which direction it expands to fill the available space. Bear in mind that widgets are packed as tight as possible, and that once packed, they are never repacked, moved or resized. That is, if e.g. a widget is packed against the top, it will sit in the middle (if no Fill X is specified), and will not move if a widget is packed against the right-hand side, even if the window is increased in size to make a new widget fit.
Expand just means that the widget expands when the containing element is expanded (i.e. the window is resized), and Anchor specifies a gravity (a side to which the widgets stick). The rest create a padding border around the widget in various directions.
It is quite normal that most of the time the arrangement of the widgets will not look like intended, and you will need to use frame widgets (see Section 4.1).