Here you can find the source of SelectedOptionButton(Container container)
public static String SelectedOptionButton(Container container)
//package com.java2s; /*/*w ww . j a v a 2s . c om*/ Part of the Papilio Loader Copyright (c) 2010-11 GadgetFactory LLC This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.awt.Component; import java.awt.Container; import javax.swing.JRadioButton; public class Main { public static String SelectedOptionButton(Container container) { for (Component optIterator : container.getComponents()) { if (optIterator instanceof JRadioButton) { JRadioButton optSelected = (JRadioButton) optIterator; if (optSelected.isSelected()) { return optSelected.getActionCommand(); } } } return ""; } }