Originally posted by Ernest Friedman-Hill:
...the preferred sizes of all components managed by a GridLayout are totally ignored. The size of the parent is divided into a grid of equal sized boxes, and the components are sized to fit the boxes. This is documented on GridLayout's Javadoc page.
I wouldn't say that GridLayout total ignores the preferred sizes of the components. Consider this demo: all the components end up with size 200x200:
With frame.pack, containers *may* (depending on how they're nested etc..) ask their layout managers to compute a preferred size, and in turn that *may* cause the layout managers to ask the container's components about their preferred sizes. In the above example, the components say 100x200 or 200x100, and the GridLayout combines that to come up with a 400x400 container, divided into four 200x200 cells.
As for the original posting, the key thing to realize is that in a GridLayout, all rows will have the same height and all columns will have the same width, and that is why the button has so much space around it. You're going to have to use a different layout, like GridBagLayout, or nest layouts further, to get what you want.