Using visual swing JPopup menu in netbeans

岁酱吖の 提交于 2019-12-11 02:06:11

问题


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

  1. Drag a pop up menu on to the screen
  2. Go to the Inspector Window (Window -> Navigating -> Inspector)
  3. You will see an element there - jPopupMenu1
  4. Right click jPopupMenu1 -> Add from Palette
  5. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!