Here you can find the source of buttonGroup(JToggleButton b1, JToggleButton b2)
Parameter | Description |
---|---|
b1 | Button 1 |
b2 | Button 2 |
public static ButtonGroup buttonGroup(JToggleButton b1, JToggleButton b2)
//package com.java2s; /*// w w w. j av a 2 s.c o m * Copyright 1997-2016 Unidata Program Center/University Corporation for * Atmospheric Research, P.O. Box 3000, Boulder, CO 80307, * support@unidata.ucar.edu. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or (at * your option) any later version. * * This library 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 Lesser * General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import javax.swing.ButtonGroup; import javax.swing.JToggleButton; public class Main { /** * Create a button group and add the two buttons to it. * * @param b1 Button 1 * @param b2 Button 2 * @return The created button group. */ public static ButtonGroup buttonGroup(JToggleButton b1, JToggleButton b2) { ButtonGroup bg = new ButtonGroup(); bg.add(b1); bg.add(b2); return bg; } /** * Create a button group and add the three buttons to it. * * @param b1 Button 1 * @param b2 Button 2 * @param b3 Button 3 * @return The created button group. */ public static ButtonGroup buttonGroup(JToggleButton b1, JToggleButton b2, JToggleButton b3) { ButtonGroup bg = buttonGroup(b1, b2); bg.add(b3); return bg; } /** * Create a button group and add the three buttons to it. * * @param b1 Button 1 * @param b2 Button 2 * @param b3 Button 3 * @param b4 Button 3 * @return The created button group. */ public static ButtonGroup buttonGroup(JToggleButton b1, JToggleButton b2, JToggleButton b3, JToggleButton b4) { ButtonGroup bg = buttonGroup(b1, b2, b3); bg.add(b4); return bg; } }