-1

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 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?

jzd
  • 23,473
  • 9
  • 54
  • 76
Martin
  • 767
  • 2
  • 9
  • 21

1 Answers1

2

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

jzd
  • 23,473
  • 9
  • 54
  • 76
  • What isn't working? You need to post an SSCCE or give a lot more specific detail before anyone can help. – jzd Aug 26 '11 at 14:55