i want to add a popup menu to my app but when i add it to my panel i see its disappear. how i can edit jpopup menu visualy like other menus?
Asked
Active
Viewed 6,595 times
2
-
I'm not sure how we can guess what you're doing wrong based on the small amount of information that you've provided. You may want to give the details and some pertinent code. – Hovercraft Full Of Eels Apr 16 '11 at 18:21
-
i were mentioned i used netbeans visual panel. – ShirazITCo Apr 16 '11 at 18:30
-
2You still are telling us very little, not nearly enough (in my opinion) for folks to be able to help you well. Please have a look at this link -- [How To Ask Smart Questions](http://catb.org/~esr/faqs/smart-questions.html) -- for tips on what information would help others to better be able to answer your question. Much luck! – Hovercraft Full Of Eels Apr 16 '11 at 18:50
1 Answers
5
I think you're talking about using the matisse visual designer in NetBeans.
In which case the process is slightly different from creating menubar menus that you can just drag onto the screen.
The steps to get this to work are as follows
- Drag a pop up menu on to the screen
- Go to the Inspector Window (Window -> Navigating -> Inspector)
- You will see an element there - jPopupMenu1
- Right click jPopupMenu1 -> Add from Palette
- This submenu will show you all the items that can be added to your pop-up menu
After you have selected the item you will see it listed as a child node of jPopupMenu1.
To change the order of your menu items, select an item, right click and select move up or move down.
Don't forget that although you've added the pop-up menu to the form you still need to register the pop-up menu with the component that you want it to activate for, the easiest way to do so is via SetComponentPopupMenu().
-
2+1 for a reasonable guess. Using [`setComponentPopupMenu()`](http://download.oracle.com/javase/6/docs/api/javax/swing/JComponent.html#setComponentPopupMenu%28javax.swing.JPopupMenu%29) may be easier in this case. – trashgod Apr 16 '11 at 19:50
-
Clearly i don't mess with pop-up menus that often, didn't even know that method existed! will revise the last paragraph of my answer to use the setComponentPopupMenu() – Tim Sparg Apr 16 '11 at 20:08