Here you can find the source of setBtnValue(ButtonGroup group, String value)
public static void setBtnValue(ButtonGroup group, String value)
//package com.java2s; //License from project: Open Source License import java.util.Enumeration; import javax.swing.AbstractButton; import javax.swing.ButtonGroup; public class Main { public static void setBtnValue(ButtonGroup group, String value) { for (Enumeration<AbstractButton> e = group.getElements(); e .hasMoreElements();) {/*from w ww .java 2 s. co m*/ AbstractButton btn = e.nextElement(); if (btn.getActionCommand().equals(value)) { group.setSelected(btn.getModel(), true); break; } } } }