The standard UI for a frame it to have a:
- Title bar
- Menu bar
- Tool bar
displayed vertically.
So the standard code would be:
frame.setJMenuBar( menuBar );
frame.add(toolBar, BorderLayout.Page_START);
If you really want the menuBar and toolBar to display on the same line then you would need to add the toolBar to the menuBar.
The code might be something like:
menuBar.add( Box.createHorizontalGlue() );
menuBar.add( toolBar );
Now the toolBar will appear on the right side of the frame.
If you want the toolBar right beside the menuBar then try:
menuBar.add( Box.createHorizontalStrut(10) );
menuBar.add( toolBar );