Here you can find the source of createMenuItem(ActionListener listener, String cmd, String toolTip)
public static JMenuItem createMenuItem(ActionListener listener, String cmd, String toolTip)
//package com.java2s; /**//from w w w. j a v a 2s .c om * Copyright (c) 2014, by the Authors: John E Lloyd (UBC) * * This software is freely available under a 2-clause BSD license. Please see * the LICENSE file in the ArtiSynth distribution directory for details. */ import java.awt.event.ActionListener; import javax.swing.JMenuItem; public class Main { public static JMenuItem createMenuItem(ActionListener listener, String cmd, String toolTip) { JMenuItem item = new JMenuItem(cmd); item.setActionCommand(cmd); item.addActionListener(listener); item.setToolTipText(toolTip); return item; } }