有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

变量源名称的java自定义事件处理

我正在创建一个带有子菜单的菜单,我想在列表中显示客户端。现在,客户机被添加到显示其名字和姓氏的子菜单中

menuItemNames.add(((Person)model.get(i)).getfName() + " "+ ((Person)model.get(i)).getlName());
            for (int x=0; x<menuItemNames.size();x++){
                JMenuItem item = new JMenuItem(menuItemNames.get(x).toString());
                item.addActionListener(this);
                listItemSearchName.add(item);
            }

listItemSearchName是添加该项的菜单

在我的actionPerformed方法中,我希望能够知道listItemSearchName菜单中的内容何时被点击


共 (0) 个答案