JComponent () { JPanel panel = new JPanel(new GridBagLayout()); panel.setBorder(BorderFactory.createEmptyBorder(4,8,8,4)); GridBagConstraints gbConstraints = new GridBagConstraints(); gbConstraints.gridy = 0; gbConstraints.gridx = 0; gbConstraints.gridwidth = 1; gbConstraints.gridheight = 1; gbConstraints.weightx = 1; gbConstraints.fill = GridBagConstraints.BOTH; gbConstraints.insets = JBInsets.emptyInsets(); Object @NotNull [] params1 = new Object[]{(myFileName != null ? myFileName : "")}; myRbCurrentFile = new JRadioButton(mySelectedFileCount > 1 ? EditorBundle.message("print.files.radio", mySelectedFileCount) : EditorBundle.message("print.file.name.radio", params1)); panel.add(myRbCurrentFile, gbConstraints); myRbSelectedText = new JRadioButton(mySelectedText != null ? mySelectedText : EditorBundle.message("print.selected.text.radio")); gbConstraints.gridy++; gbConstraints.insets = JBInsets.emptyInsets(); panel.add(myRbSelectedText, gbConstraints); Object @NotNull [] params = new Object[]{(myDirectoryName != null ? myDirectoryName : "")}; myRbCurrentPackage = new JRadioButton( EditorBundle.message("print.all.files.in.directory.radio", params)); gbConstraints.gridy++; gbConstraints.insets = JBInsets.emptyInsets(); panel.add(myRbCurrentPackage, gbConstraints); myCbIncludeSubpackages = new JCheckBox(EditorBundle.message("print.include.subdirectories.checkbox")); gbConstraints.gridy++; gbConstraints.insets = JBUI.insetsLeft(20); panel.add(myCbIncludeSubpackages, gbConstraints); ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.add(myRbCurrentFile); buttonGroup.add(myRbSelectedText); buttonGroup.add(myRbCurrentPackage); ActionListener actionListener = e -> updateDependentComponents(); myRbCurrentFile.addActionListener(actionListener); myRbSelectedText.addActionListener(actionListener); myRbCurrentPackage.addActionListener(actionListener); return panel; }