List of usage examples for javax.swing JMenu getActionListeners
@BeanProperty(bound = false)
public ActionListener[] getActionListeners()
ActionListener
s added to this AbstractButton with addActionListener(). From source file:org.openmicroscopy.shoola.env.ui.TaskBarView.java
/** * Copies the items from the specified menu and creates a new menu. * * @param original The menu to handle.//from ww w. j a v a2s .c o m * @return See above. */ private JMenu copyItemsFromMenu(JMenu original) { Component[] comps = original.getPopupMenu().getComponents(); JMenu menu = new JMenu(); menu.setText(original.getText()); menu.setToolTipText(original.getToolTipText()); ActionListener[] al = original.getActionListeners(); for (int j = 0; j < al.length; j++) menu.addActionListener(al[j]); MenuKeyListener[] mkl = original.getMenuKeyListeners(); for (int j = 0; j < mkl.length; j++) menu.addMenuKeyListener(mkl[j]); MenuListener[] ml = original.getMenuListeners(); for (int j = 0; j < ml.length; j++) menu.addMenuListener(ml[j]); for (int i = 0; i < comps.length; i++) { if (comps[i] instanceof JMenu) { menu.add(copyItemsFromMenu((JMenu) comps[i])); } else if (comps[i] instanceof JMenuItem) { menu.add(copyItem((JMenuItem) comps[i])); } else if (comps[i] instanceof JSeparator) { menu.add(new JSeparator(JSeparator.HORIZONTAL)); } } return menu; }