Java Swing Menu Item makeMenuItem(URL iconURL, String text, ActionListener listener)

Here you can find the source of makeMenuItem(URL iconURL, String text, ActionListener listener)

Description

make Menu Item

License

Open Source License

Declaration

public static JMenuItem makeMenuItem(URL iconURL, String text, ActionListener listener) 

Method Source Code


//package com.java2s;

import java.awt.event.ActionListener;

import java.net.URL;

import javax.swing.ImageIcon;

import javax.swing.JMenuItem;

public class Main {
    public static JMenuItem makeMenuItem(URL iconURL, String text, ActionListener listener) {
        JMenuItem item = new JMenuItem(text);
        item.addActionListener(listener);
        if (iconURL != null) {
            item.setIcon(new ImageIcon(iconURL, text));
        }/*from w ww  .  j  a v a2  s . c o  m*/

        return item;
    }
}

Related

  1. makeMenu(String name, List menuItems)
  2. makeMenuItem(Icon icon, Icon rollover, String menu_cmd, boolean is_toggle, int mnemonic, int accel)
  3. makeMenuItem(Icon icon, Icon rollover, String menu_cmd, boolean is_toggle, int mnemonic, int accel)
  4. makeMenuItem(String label, final Object object, final String methodName)
  5. makeMenuItem(String s, ActionListener listener)
  6. newMenuItem(String name, KeyStroke keyStroke, final Runnable runnable)
  7. paintMenuItemBackground(Graphics g, Component c)
  8. userManualMenuItem()