Here you can find the source of createCheckBox(String name, String command, boolean selected)
public static JCheckBox createCheckBox(String name, String command, boolean selected)
//package com.java2s; /*/*from ww w . ja va2s. com*/ * ActionUtilities.java 6/7/13 2:28 PM * * Copyright (C) 2012-2013 Nick Ma * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 3 * of the License, or any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ import java.awt.event.ActionListener; import javax.swing.JCheckBox; public class Main { public static JCheckBox createCheckBox(ActionListener actionListener, String name, String command, boolean selected) { JCheckBox item = new JCheckBox(name, selected); item.setActionCommand(command); if (actionListener != null) { item.addActionListener(actionListener); } return item; } public static JCheckBox createCheckBox(ActionListener actionListener, String name, String command) { return createCheckBox(actionListener, name, command, false); } public static JCheckBox createCheckBox(String name, String command, boolean selected) { return createCheckBox(null, name, command, selected); } public static JCheckBox createCheckBox(String name, String command) { return createCheckBox(null, name, command, false); } }