Java JCheckBoxMenuItem createJCheckBoxMenuItem(String name, String command, ActionListener listener, boolean isSelected)

Here you can find the source of createJCheckBoxMenuItem(String name, String command, ActionListener listener, boolean isSelected)

Description

Creates a check box menu item with specified name, acton command and state.

License

Open Source License

Declaration

public static JCheckBoxMenuItem createJCheckBoxMenuItem(String name, String command, ActionListener listener,
        boolean isSelected) 

Method Source Code


//package com.java2s;
import java.awt.event.ActionListener;

import javax.swing.JCheckBoxMenuItem;

public class Main {
    /**//from  w  ww.jav a 2  s  . com
     * Creates a check box menu item with specified name, acton command and state.
     */
    public static JCheckBoxMenuItem createJCheckBoxMenuItem(String name, String command, ActionListener listener,
            boolean isSelected) {
        JCheckBoxMenuItem item = new JCheckBoxMenuItem(name);
        item.setActionCommand(command);
        item.addActionListener(listener);
        item.setSelected(isSelected);
        return item;
    }

    /**
     * Creates a check box menu item with specified name and acton command.
     */
    public static JCheckBoxMenuItem createJCheckBoxMenuItem(String name, String command, ActionListener listener) {
        return createJCheckBoxMenuItem(name, command, listener, false);
    }
}

Related

  1. configureJCheckBoxMenuItem( final JCheckBoxMenuItem mi, final Action a)
  2. createCheckBoxMenuItem(final JInternalFrame f)
  3. createCheckBoxMenuItem(final String text, final boolean selected)
  4. createCheckBoxMenuItem(String label, int mnemonic, String description, ItemListener action)
  5. createCheckBoxMenuItem(String text, Icon icon, String toolTip, ActionListener... listeners)
  6. unconfigureJCheckBoxMenuItem(JCheckBoxMenuItem mi, Action a)