• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JMenuBar

 
Jay Kamdar
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Should you use the JFrame's setJmenuBar method to a menu or the JFrame's getContentPane method and use the Container got that returned method add to menu if you are trying to get the menu to the top of the screen like normal toobars and menus?

How would you do the second one, I don't know how to position the menu in a Container?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To use a JMenuBar, you use the setJMenuBar method of JFrame -- period. There's no standard provision for putting the menubar anywhere else. It goes at the top of the JFrame.

"Normal" is relative of course. Because you're mentioned the top of the screen, I wonder if you're talking about how things work on the Macintosh? If so, there is a platform-specific extension for doing that. If you are talking about Macs, let me know, and I'll move this to our MacOS forum; otherwise, I'll move it to our Swing forum.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic