File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes adding JPopupMenu to a JMenuBar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "adding JPopupMenu to a JMenuBar" Watch "adding JPopupMenu to a JMenuBar" New topic
Author

adding JPopupMenu to a JMenuBar

Tal Tal
Ranch Hand

Joined: Dec 10, 2003
Posts: 40
hi
how can i add a JPopupMenu to a JMenuBar?
thanks
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

Why would you want to do that?


GenRocket - A Test Data Generation Platform
Tal Tal
Ranch Hand

Joined: Dec 10, 2003
Posts: 40
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
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: adding JPopupMenu to a JMenuBar
 
Similar Threads
repaint() method problem
JPopUp
Image is always behind the menu (swing)
Right-Click on JMenuItem
JPopupMenu or JMenu - neither is quite what I'm after.