void (final JRadioButton[] radioButtons, ChangeListener listener) { final ButtonGroup group = new ButtonGroup(); for (final JRadioButton radioButton : radioButtons) { radioButton.getModel().addChangeListener(listener); group.add(radioButton); } if (group.getSelection() == null) group.setSelected(radioButtons[0].getModel(), true); }