I presume you want to use that BoxLayout for the JFrame layout? Try setting the layout of the content pane instead of the JFrame.


getContentPane().setLayout(new BoxLayout(getContentPane(),...