Java JButton Settings buttonGroup(AbstractButton b1, AbstractButton b2)

Here you can find the source of buttonGroup(AbstractButton b1, AbstractButton b2)

Description

buttonGroup.

License

Open Source License

Declaration

public static ButtonGroup buttonGroup(AbstractButton b1, AbstractButton b2) 

Method Source Code

//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;
    }
}

Related

  1. addMiddleButtonDragSupport(Component targetComponent)
  2. addRadioButton(JPanel buttonPanel, ButtonGroup group, String buttonName, boolean selected, ActionListener listener)
  3. addToButtonGroup(ButtonGroup bg, T button)
  4. applyDefaultProperties(final Button comp)
  5. askYesNoQuestion(String dlgTitle, String question, Component parent, Object[] buttonTittle)
  6. buttonGroup(JToggleButton b1, JToggleButton b2)
  7. clickButton(final Window window, final String buttonText)
  8. configureOKAndCancelButtons(JPanel panel, Action ok, Action cancel)
  9. configureTextAndMnemonic(AbstractButton button, String text)