• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JMenuBar

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I'm full of tinier men! And a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic