Here you can find the source of buttonGroup(AbstractButton b1, AbstractButton b2)
public static ButtonGroup buttonGroup(AbstractButton b1, AbstractButton b2)
//package com.java2s; import javax.swing.*; public class Main { /**************************************************************************** * buttonGroup.//ww w. ja v a 2s . c o m ****************************************************************************/ public static ButtonGroup buttonGroup(AbstractButton b1, AbstractButton b2) { return buttonGroup(new AbstractButton[] { b1, b2 }); } public static ButtonGroup buttonGroup(AbstractButton b1, AbstractButton b2, AbstractButton b3) { return buttonGroup(new AbstractButton[] { b1, b2, b3 }); } public static ButtonGroup buttonGroup(AbstractButton b1, AbstractButton b2, AbstractButton b3, AbstractButton b4) { return buttonGroup(new AbstractButton[] { b1, b2, b3, b4 }); } public static ButtonGroup buttonGroup(AbstractButton[] buttons) { ButtonGroup group = new ButtonGroup(); for (int i = 0; i < buttons.length; i++) { group.add(buttons[i]); } return group; } }