Java JRadioButton isRadioButtonSelected(JRadioButton radioButton)

Here you can find the source of isRadioButtonSelected(JRadioButton radioButton)

Description

Determines if radio button is selected.

License

Open Source License

Parameter

Parameter Description
radioButton a parameter

Declaration

public static boolean isRadioButtonSelected(JRadioButton radioButton) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import javax.swing.DefaultButtonModel;
import javax.swing.JRadioButton;

public class Main {
    /**/*ww  w .ja va2  s.  c om*/
     * Determines if radio button is selected.
     * 
     * @param radioButton
     * @return
     */
    public static boolean isRadioButtonSelected(JRadioButton radioButton) {

        DefaultButtonModel model = (DefaultButtonModel) radioButton.getModel();
        return model.getGroup().isSelected(model);
    }
}

Related

  1. addSelectedPropertyChangeEventForJRadioButton(final JRadioButton button)
  2. groupRadioButtons(JRadioButton[] buttonArray)
  3. regroupeBoutons(JRadioButton[] tab)