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
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.
Write once, run anywhere, because there's nowhere to hide! - /. A.C.