void (ButtonGroup group, String fill) { for (Enumeration<AbstractButton> e = group.getElements(); e.hasMoreElements(); ) { AbstractButton button = e.nextElement(); String s = button.getActionCommand().replace('-', '_'); if (s.equalsIgnoreCase(fill)) { button.setSelected(true); break; } } }