wood burning stoves*
The moose likes Swing / AWT / SWT and the fly likes JPopUp 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 "JPopUp" Watch "JPopUp" New topic
Author

JPopUp

Drake Silver
Ranch Hand

Joined: Apr 21, 2002
Posts: 80
hi,
I'm wondering if someone can help me out with a Jpopup menu.
I've been reading, and it says that with every menu, a Jpopup is associated to it..
What?:confused"
I get from this that If I add a Jpopup, I can link the new popupmenu items to the Jmenu Items..
Did I Understand that correctly?
How would I join the popup's menu items to the Jmenu menu items?
thank you


"Shh, Zog....here come one Now!"
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

No... what that means is that the way that the Java API programmers have implemented the JMenu class is basically by making it a JButton that launches a JPopupMenu under it when the button is pressed. To make your own JPopupMenu, you would have to create it, and show it when appropriate actions were performed ( i.e. clicking a button, right clicking some area, etc. ). If you want to mirror menu items in your own JPopupMenu that are also inside menus in your JMenuBar I would suggest using Actions instead of JMenuItems. Use the AbstractAction class, in the constructor set up all the properties like the name, tooltip, icon, etc. and then write the actionPerformed() method to say what it does. This way you can add the Action to the JMenu, and later you can add the Action to the JPopupMenu, and have them behave the same.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JPopUp
 
Similar Threads
JPopup That Looks Like ToolTip
Error when calling a constructor
incomplete menu shown
How to create horizontal menus
Swing Menu item with no children?