在NetBeans中使用可视的Swop

在NetBeans中使用可视的Swop

本文介绍了在NetBeans中使用可视的Swop JPopup菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的应用程序中添加一个弹出菜单,但是当我将其添加到面板中时,它消失了.我如何像其他菜单一样直观地编辑jpopup菜单?

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?

推荐答案

我认为您是在谈论在NetBeans中使用Matisse视觉设计器.

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. 将弹出菜单拖动到屏幕上
  2. 转到检查器窗口(窗口->导航->检查器)
  3. 您将在其中看到一个元素-jPopupMenu1
  4. 右键单击jPopupMenu1->从面板添加
  5. 此子菜单将向您显示可以添加到弹出菜单的所有项目

选择项目后,您将看到它作为jPopupMenu1的子节点列出.

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.

别忘了,尽管您已经将弹出菜单添加到了表单中,但仍然需要使用您要为其激活其组件的组件来注册弹出菜单,最简单的方法是通过 SetComponentPopupMenu() .

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().

这篇关于在NetBeans中使用可视的Swop JPopup菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 23:23