Alex Rivera | Logout

add JMenuBar to a JPanel?

Asked 2010-11-28T23:51:04.133
16

I've got a JMenuBar and a JPanel. I'd like to add the JMenuBar to the JPanel. How would I do so?

Edit
Report

2 Answers

5

JMenuBars are set to the JFrame using the setJMenuBar method.

See the following tutorial on how to use them.

http://download.oracle.com/javase/tutorial/uiswing/components/menu.html

answered 2010-11-28T23:55:16.613
0

I tried too but JMenuItem with Jmenu and JmenuBar was not added to JPanel. But you can get that feel if you declare JFrame's layout as null then use setBounds(x, y, width, height) on JMenuBar instance then add the menu bar to JFrame.

answered 2011-03-10T13:19:15.467

Your Answer