Instead of using GridBagLayout, try using FlowLayout. It will set the button to the top center of the panel.