开发者

Swing JMenu problem

开发者 https://www.devze.com 2023-03-30 19:09 出处:网络
Why I can\'t add JMenuBar to JToolBar, is it possible? Or I can only add menubar on frame?Tutorial says:

Why I can't add JMenuBar to JToolBar, is it possible? Or I can only add menubar on frame?Tutorial says:

As the code shows, to set the menu bar for a JFrame, you use the setJMenuBar method. To add开发者_StackOverflow中文版 a JMenu to a JMenuBar, you use the add(JMenu) method. To add menu items and submenus to a JMenu, you use the add(JMenuItem) method.

And how to set the menu bar for a JToolBar?


Yes you would add a JMenu not a JMenuBar to a JToolBar. A JMenuBar goes accross the frame.

0

精彩评论

暂无评论...
验证码 换一张
取 消