List of usage examples for javax.swing JMenu getActionCommand
public String getActionCommand()
From source file:TreeUtil.java
/** Creates the menus by using recursion */ public JMenuItem getMenus(DefaultMutableTreeNode node, JMenu parentMenu) { String name = node.getUserObject().toString(); int numChild = node.getChildCount(); if (numChild < 1) { JMenuItem tempMenu = new JMenuItem(name); tempMenu.setActionCommand(parentMenu.getActionCommand() + "." + name); tempMenu.addActionListener(this); return tempMenu; }//from www. j a va2s.com JMenu tempMenu = new JMenu(name); tempMenu.setActionCommand(parentMenu.getActionCommand() + "." + name); tempMenu.addActionListener(this); for (int i = 0; i < numChild; i++) { tempMenu.add(getMenus((DefaultMutableTreeNode) node.getChildAt(i), tempMenu)); } return tempMenu; }