JToolBar/JMenu position overlap

196 Views Asked by At

I am trying to put on a JMenu and JToolbar in the NORTH position of a JFrame but they overlap each other. Is there any way to put both on NORTH position?

1

There are 1 best solutions below

0
camickr On BEST ANSWER

Don't attempt to add both components to the NORTH of the frame.

The frame reserves a special location for the menu bar. So your code should be somethink like:

frame.setJMenuBar( menuBar );
frame.add(northPanel, BorderLayout.PAGE_START);

Read the section from the Swing tutorial on How to Use Menu for more information and working examples to get you started.