add JMenuBar to a JPanel?

后端 未结 5 465
孤城傲影
孤城傲影 2020-12-03 17:11

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

5条回答
  •  萌比男神i
    2020-12-03 18:00

    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.

提交回复
热议问题