void () { ButtonGroup bg = new ButtonGroup(); myProjectRadioButton = new JRadioButton(); myDirectoryRadioButton = new JRadioButton(); bg.add(myProjectRadioButton); bg.add(myDirectoryRadioButton); ActionListener listener = e -> myDirectoryTextField.setEnabled(myDirectoryRadioButton.isSelected()); myProjectRadioButton.addActionListener(listener); myDirectoryRadioButton.addActionListener(listener); myDirectoryRadioButton.setSelected(true); myVCSComboBox = buildVcsesComboBox(myProject); }