Here you can find the source of makeMenuItem(URL iconURL, String text, ActionListener listener)
public static JMenuItem makeMenuItem(URL iconURL, String text, ActionListener listener)
//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; } }