Here you can find the source of numberButtonGroup(ButtonGroup buttonGroup)
public static void numberButtonGroup(ButtonGroup buttonGroup)
//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 numberButtonGroup(ButtonGroup buttonGroup) { int entry = 0; Enumeration<AbstractButton> buttons = buttonGroup.getElements(); while (buttons.hasMoreElements()) { AbstractButton button = buttons.nextElement(); button.setActionCommand(Integer.toString(entry++)); }// w ww .ja va2 s .c o m } }