Set JMenuBar position below JPanel
-
25-10-2019 - |
Question
I am working with a JDialog that is setUndecorated(true) and has a JPanel included to replace the default title bar. Currently there is an internal frame inside the JDialog which has among other things a JMenuBar attached to it.
I would like to move the JMenuBar to the JDialog but have it displayed below the JPanel. How can I have a JMenuBar which is added to a JDialog appear below a JPanel which is added to the same JDialog.
Solution
Make sure your panel uses a BorderLayout. Then you can use:
panel.add(menuBar, BorderLayout.South);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow