JComponent () { final JPanel radioPanel = new JPanel(); radioPanel.setLayout(new BoxLayout(radioPanel, BoxLayout.Y_AXIS)); final JLabel descriptionLabel = new JLabel(RefactoringBundle.message("what.would.you.like.to.do")); descriptionLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); radioPanel.add(descriptionLabel); final ButtonGroup bg = new ButtonGroup(); boolean selected = true; int rIdx = 0; for (final @NlsContexts.RadioButton String renamer : myRenamers) { final JRadioButton rb = new JRadioButton(renamer, selected); myRButtons[rIdx++] = rb; final ItemListener listener = new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (rb.isSelected()) { mySelection = renamer; } } }; rb.addItemListener(listener); selected = false; bg.add(rb); radioPanel.add(rb); } RadioUpDownListener.installOn(myRButtons); return radioPanel; }