Here you can find the source of createJCheckBoxForTable(boolean selected)
Parameter | Description |
---|---|
selected | It determines whether the newly-created check box will be selected or not. |
static public JCheckBox createJCheckBoxForTable(boolean selected)
//package com.java2s; /*/*from www . j a v a 2 s . com*/ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. * */ import java.awt.Color; import javax.swing.JCheckBox; import javax.swing.SwingConstants; public class Main { /** * The foreground color for the table components. * * @see #createJLabelForTable() * @see #createJLabelForTable(String) * @see #createJCheckBoxForTable(boolean) */ static final public Color TABLE_COMPONENT_FG_COLOR = Color.BLACK; /** * The background color for the table components. * * @see #createJLabelForTable() * @see #createJLabelForTable(String) * @see #createJCheckBoxForTable(boolean) */ static final public Color TABLE_COMPONENT_BG_COLOR = Color.WHITE; /** * It creates a new check box for inclusion in a table and sets * its "is selected" attribute to the given value. * * @param selected It determines whether the newly-created check box * will be selected or not. * @return A new check box for inclusion in a table. */ static public JCheckBox createJCheckBoxForTable(boolean selected) { JCheckBox checkBox = new JCheckBox(); checkBox.setOpaque(true); checkBox.setHorizontalAlignment(SwingConstants.CENTER); checkBox.setForeground(TABLE_COMPONENT_FG_COLOR); checkBox.setBackground(TABLE_COMPONENT_BG_COLOR); checkBox.setSelected(selected); return checkBox; } }