Here you can find the source of makeMenuItem(Icon icon, Icon rollover, String menu_cmd, boolean is_toggle, int mnemonic, int accel)
private static JMenuItem makeMenuItem(Icon icon, Icon rollover, String menu_cmd, boolean is_toggle, int mnemonic, int accel)
//package com.java2s; import javax.swing.*; public class Main { static final private int META_KEY = java.awt.Event.CTRL_MASK; private static JMenuItem makeMenuItem(Icon icon, Icon rollover, String menu_cmd, boolean is_toggle, int mnemonic, int accel) { JMenuItem mi;/*from w ww .j a v a2 s. c o m*/ if (is_toggle) mi = new JCheckBoxMenuItem(menu_cmd); else mi = new JMenuItem(menu_cmd); if (icon != null) mi.setIcon(icon); if (rollover != null) { mi.setRolloverIcon(rollover); mi.setRolloverSelectedIcon(rollover); mi.setPressedIcon(rollover); mi.setRolloverEnabled(true); } mi.setHorizontalTextPosition(SwingConstants.LEFT); if (mnemonic != 0) mi.setMnemonic(mnemonic); if (accel != 0) mi.setAccelerator(KeyStroke.getKeyStroke(accel, META_KEY)); return mi; } }