Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

adding JPopupMenu to a JMenuBar

 
Tal Tal
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
how can i add a JPopupMenu to a JMenuBar?
thanks
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you want to do that?
 
Tal Tal
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because, i already have in my project a popupmenu, which now i also want to add that menu to the menubar, so i wondered if there's a way to add that jpopupmenu to the menubar instead of creating the same menu as a JMenu and adding that.

is there a way of doing that?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tal Tal:
because, i already have in my project a popupmenu, which now i also want to add that menu to the menubar, so i wondered if there's a way to add that jpopupmenu to the menubar instead of creating the same menu as a JMenu and adding that.

is there a way of doing that?


Not that I know of. You could create these menu items in a method and then call that method for creating both your JMenuBar and your JPopupMenu. That way, you have only coded those items one time.
 
mooooooo ..... tiny ad ....
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!