com.intellij.ui.components.JBRadioButton Java Examples

The following examples show how to use com.intellij.ui.components.JBRadioButton. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SelectPackageTemplateDialog.java    From PackageTemplates with Apache License 2.0 6 votes vote down vote up
private void makePathButton() {
        btnPath = new TextFieldWithBrowseButton();
        btnPath.setText(PackageTemplateHelper.getRootDirPath());
        btnPath.addBrowseFolderListener(Localizer.get("SelectPackageTemplate"), "", project, FileReaderUtil.getPackageTemplatesDescriptor());

//        panel.add(new SeparatorComponent(), new CC().growX().spanX().wrap());
        panel.add(btnPath, new CC().pushX().growX().spanX());
        addPathButtons();

        rbFromPath = new JBRadioButton(Localizer.get("label.FromPath"));
        rbFromPath.addItemListener(e -> {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                toggleSourcePath(
                        TemplateSourceType.PATH,
                        null,
                        btnPath
                );
            }
        });

        panel.add(rbFromPath, new CC().growX().spanX().wrap());
    }
 
Example #2
Source File: SelectPackageTemplateDialog.java    From PackageTemplates with Apache License 2.0 6 votes vote down vote up
private void buildFavouritesUI() {
    resetFavourites();
    createFavouriteRadioButtons();

    if (!listButtons.isEmpty()) {
        cbCompactNames = new JCheckBox(Localizer.get("label.CompactNames"), isCompactNames);
        cbCompactNames.addItemListener(e -> {
            isCompactNames = e.getStateChange() == ItemEvent.SELECTED;
            buildFavouritesUI();
        });

        favouritesPanel.add(new SeparatorComponent(), new CC().growX().spanX().wrap());
        favouritesPanel.add(new JBLabel(Localizer.get("label.Favourites")), new CC().growX().spanX().pushX().wrap().alignX("center"));
        favouritesPanel.add(cbCompactNames, new CC().spanX().wrap().gapY("0", "10pt"));

        for (JBRadioButton radioButton : listButtons) {
            favouritesPanel.add(radioButton, new CC().growX().spanX().wrap());
        }

        listButtons.get(0).doClick();
    } else {
        rbFromPath.doClick();
    }
}
 
Example #3
Source File: SelectPackageTemplateDialog.java    From PackageTemplates with Apache License 2.0 5 votes vote down vote up
private void resetFavourites() {
    for (JBRadioButton btn : listButtons) {
        buttonGroup.remove(btn);
    }
    listButtons.clear();
    favouritesPanel.removeAll();
    favouritesPanel.revalidate();
}
 
Example #4
Source File: ServiceAuthDialog.java    From consulo with Apache License 2.0 5 votes vote down vote up
public ServiceAuthDialog() {
  super(null);
  setTitle("Service Authorization");
  myRoot = new JPanel(new VerticalFlowLayout(0, 0));

  myServiceAuthConfiguration = ServiceAuthConfiguration.getInstance();

  myAsAnonymousButton = new JBRadioButton("Logged as anonymous");
  myLogAsButton = new JBRadioButton("Log as user");

  JPanel loginPanel = new JPanel(new VerticalFlowLayout(0, 0));
  myEmailField = new JBTextField();
  loginPanel.add(LabeledComponent.left(myEmailField, "Email"));

  ButtonGroup group = new ButtonGroup();
  group.add(myAsAnonymousButton);
  group.add(myLogAsButton);

  myLogAsButton.addItemListener(e -> UIUtil.setEnabled(loginPanel, e.getStateChange() == ItemEvent.SELECTED, true));

  myRoot.add(myAsAnonymousButton);
  myRoot.add(myLogAsButton);
  myRoot.add(loginPanel);

  String email = myServiceAuthConfiguration.getEmail();
  if (email == null) {
    myAsAnonymousButton.setSelected(true);
  }
  else {
    myLogAsButton.setSelected(true);
    myEmailField.setText(email);
  }

  pack();
  init();
}
 
Example #5
Source File: IdeaUIComponentFactory.java    From netbeans-mmd-plugin with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public JRadioButton makeRadioButton() {
  return new JBRadioButton();
}
 
Example #6
Source File: ReferencePointTab.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a panel to specify how a shared reference point is represented locally.
 *
 * @param referencePointName the name of the shared reference point contained in the resource
 *     negotiation data
 */
ReferencePointTab(
    @NotNull String referencePointName,
    @NotNull ReferencePointTabStateListener referencePointTabStateListener) {

  this.referencePointName = referencePointName;
  this.referencePointTabStateListener = referencePointTabStateListener;

  this.referencePointTabPanel = new JPanel();
  this.projectComboBox = new ComboBox<>();
  this.createNewDirectoryRadioButton = new JBRadioButton();
  this.useExistingDirectoryRadioButton = new JBRadioButton();

  this.newDirectoryNameTextField = new JBTextField();
  this.newDirectoryBasePathTextField = new TextFieldWithBrowseButton();
  this.existingDirectoryPathTextField = new TextFieldWithBrowseButton();

  this.newDirectoryNameTextFieldShownAsValid = true;
  this.newDirectoryNameTextFieldDefaultBorder = newDirectoryNameTextField.getBorder();
  this.newDirectoryNameTextFieldErrorBorder =
      BorderFactory.createCompoundBorder(
          newDirectoryNameTextFieldDefaultBorder, BorderFactory.createLineBorder(JBColor.RED));

  this.newDirectoryBasePathTextFieldShownAsValid = true;
  this.newDirectoryBasePathTextFieldDefaultBorder =
      newDirectoryBasePathTextField.getTextField().getBorder();
  this.newDirectoryBasePathTextFieldErrorBorder =
      BorderFactory.createCompoundBorder(
          newDirectoryBasePathTextFieldDefaultBorder,
          BorderFactory.createLineBorder(JBColor.RED));

  this.existingDirectoryPathTextFieldShownAsValid = true;
  this.existingDirectoryPathTextFieldDefaultBorder =
      existingDirectoryPathTextField.getTextField().getBorder();
  this.existingDirectoryPathTextFieldErrorBorder =
      BorderFactory.createCompoundBorder(
          existingDirectoryPathTextFieldDefaultBorder,
          BorderFactory.createLineBorder(JBColor.RED));

  this.hasValidInput = false;

  initPanel();

  fillProjectComboBox();
  setUpRadioButtons();
  setUpFolderChooser();

  setInitialInput();

  addProjectComboBoxListener();
  addCreateNewDirectoryFieldListeners();
  addUseExistingDirectoryFieldListeners();
}