Example usage for javax.swing JMenuItem JMenuItem

List of usage examples for javax.swing JMenuItem JMenuItem

Introduction

In this page you can find the example usage for javax.swing JMenuItem JMenuItem.

Prototype

public JMenuItem(String text, int mnemonic) 

Source Link

Document

Creates a JMenuItem with the specified text and keyboard mnemonic.

Usage

From source file:com.AandR.beans.plotting.imagePlotPanel.CanvasPanel.java

/**
 * Access to the method used to create the popup menu items used in the Canvas Popup Menu.
 * @param label/*from   w  ww . j  av a  2  s  . c om*/
 * @param icon
 * @param keyStroke
 * @return
 */
public JMenuItem createPopupMenuItem(String label, Icon icon, KeyStroke keyStroke) {
    JMenuItem menuItem = new JMenuItem(label, icon);
    menuItem.setAccelerator(keyStroke);
    menuItem.addActionListener(this);
    menuItem.setBackground(Color.WHITE);
    menuItem.setEnabled(true);
    return menuItem;
}