Java JPopupMenu createPopupMenu(String menuText, JPopupMenu menu, ActionListener listener)

Here you can find the source of createPopupMenu(String menuText, JPopupMenu menu, ActionListener listener)

Description

create Popup Menu

License

Open Source License

Declaration

private static void createPopupMenu(String menuText, JPopupMenu menu, ActionListener listener) 

Method Source Code

//package com.java2s;
/**/*from  ww  w. j  a  va2 s .co  m*/
 * Archivists' Toolkit(TM) Copyright ? 2005-2007 Regents of the University of California, New York University, & Five Colleges, Inc.
 * All rights reserved.
 *
 * This software is free. You can redistribute it and / or modify it under the terms of the Educational Community License (ECL)
 * version 1.0 (http://www.opensource.org/licenses/ecl1.php)
 *
 * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ECL license for more details about permissions and limitations.
 *
 *
 * Archivists' Toolkit(TM)
 * http://www.archiviststoolkit.org
 * info@archiviststoolkit.org
 *
 * @author Lee Mandell
 * Date: Jun 22, 2006
 * Time: 10:26:02 AM
 */

import javax.swing.*;

import java.awt.event.ActionListener;

public class Main {
    private static void createPopupMenu(String menuText, JPopupMenu menu, ActionListener listener) {
        menu.add(createMenuItem(menuText, listener));
    }

    private static JMenuItem createMenuItem(String menuText, ActionListener listener) {
        JMenuItem menuItem = new JMenuItem(menuText);
        menuItem.addActionListener(listener);
        return menuItem;
    }
}

Related

  1. applyDefaultProperties(final JPopupMenu comp)
  2. attachPopupMenu(final JComponent component, final JPopupMenu popupMenu)
  3. cleanPopupLayoutMetrics(JPopupMenu popupMenu)
  4. computePopupLocation(MouseEvent event, Component rel, JPopupMenu popup)
  5. createPopupMenu()
  6. ensurePopupIsOnScreen(JPopupMenu popup)
  7. findMenuComponent(JPopupMenu menu, String menuComponentName)
  8. findSubMenu(JPopupMenu popupMenu, String name)
  9. getMousePopupAdapter(final Component component, final JPopupMenu popup)