问题
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?
回答1:
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().
来源:https://stackoverflow.com/questions/5688568/using-visual-swing-jpopup-menu-in-netbeans