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()); }
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(); } }
private JPanel createFieldPanel() { myDoNotReplaceRadioButton = new JBRadioButton(UIUtil.replaceMnemonicAmpersand("Do n&ot replace")); myReplaceFieldsInaccessibleInRadioButton = new JBRadioButton(UIUtil.replaceMnemonicAmpersand("Replace fields &inaccessible in usage context")); myReplaceAllFieldsRadioButton = new JBRadioButton(UIUtil.replaceMnemonicAmpersand("&Replace all fields")); myDoNotReplaceRadioButton.setFocusable(false); myReplaceFieldsInaccessibleInRadioButton.setFocusable(false); myReplaceAllFieldsRadioButton.setFocusable(false); final ButtonGroup group = new ButtonGroup(); group.add(myDoNotReplaceRadioButton); group.add(myReplaceFieldsInaccessibleInRadioButton); group.add(myReplaceAllFieldsRadioButton); final JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(myDoNotReplaceRadioButton); panel.add(myReplaceFieldsInaccessibleInRadioButton); panel.add(myReplaceAllFieldsRadioButton); panel.setBorder(IdeBorderFactory.createTitledBorder("Replace fields used in expression with their getters", true)); return panel; }
private void resetFavourites() { for (JBRadioButton btn : listButtons) { buttonGroup.remove(btn); } listButtons.clear(); favouritesPanel.removeAll(); favouritesPanel.revalidate(); }
public LicenseAgreementStep(@NotNull Disposable disposable) { super(disposable); Splitter splitter = new Splitter(false, .30f); splitter.setHonorComponentsMinimumSize(true); myChangeTree = new Tree(); splitter.setFirstComponent(ScrollPaneFactory.createScrollPane(myChangeTree)); myLicenseTextField = new JTextPane(); splitter.setSecondComponent(ScrollPaneFactory.createScrollPane(myLicenseTextField)); myDeclineRadioButton = new JBRadioButton("Decline"); myAcceptRadioButton = new JBRadioButton("Accept"); ButtonGroup optionsGroup = new ButtonGroup(); optionsGroup.add(myDeclineRadioButton); optionsGroup.add(myAcceptRadioButton); JPanel optionsPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING)); optionsPanel.add(myDeclineRadioButton); optionsPanel.add(myAcceptRadioButton); JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(splitter, BorderLayout.CENTER); mainPanel.add(optionsPanel, BorderLayout.SOUTH); setBodyComponent(mainPanel); AndroidSdkData data = AndroidSdkUtils.tryToChooseAndroidSdk(); if (data != null) { mySdkRoot = data.getLocalSdk().getLocation(); } else { mySdkRoot = null; } }
@Override public IdeaGradleProjectSettingsControlBuilder addGradleChooserComponents(PaintAwarePanel content, int indentLevel) { ButtonGroup buttonGroup = new ButtonGroup(); if(!dropUseWrapperButton) { myUseWrapperButton = new JBRadioButton(GradleBundle.message("gradle.settings.text.use.default_wrapper.configured")); myUseWrapperButton.addActionListener(myActionListener); buttonGroup.add(myUseWrapperButton); content.add(myUseWrapperButton, ExternalSystemUiUtil.getFillLineConstraints(indentLevel)); } if(!dropCustomizableWrapperButton) { myUseWrapperWithVerificationButton = new JBRadioButton(GradleBundle.message("gradle.settings.text.use.customizable_wrapper")); myUseWrapperWithVerificationButton.addActionListener(myActionListener); myUseWrapperVerificationLabel = new JBLabel(GradleBundle.message("gradle.settings.text.wrapper.customization.compatibility")); myUseWrapperVerificationLabel.setFont(UIUtil.getLabelFont(UIUtil.FontSize.MINI)); myUseWrapperVerificationLabel.setIcon(UIUtil.getBalloonInformationIcon()); buttonGroup.add(myUseWrapperWithVerificationButton); content.add(myUseWrapperWithVerificationButton, ExternalSystemUiUtil.getLabelConstraints(indentLevel)); content.add(myUseWrapperVerificationLabel, ExternalSystemUiUtil.getFillLineConstraints(indentLevel)); } if(!dropUseLocalDistributionButton) { myUseLocalDistributionButton = new JBRadioButton(GradleBundle.message("gradle.settings.text.use.local.distribution")); myUseLocalDistributionButton.addActionListener(myActionListener); buttonGroup.add(myUseLocalDistributionButton); content.add(myUseLocalDistributionButton, ExternalSystemUiUtil.getFillLineConstraints(indentLevel)); } if(!dropUseBundledDistributionButton) { myUseBundledDistributionButton = new JBRadioButton( GradleBundle.message("gradle.settings.text.use.bundled.distribution", GradleVersion.current().getVersion())); myUseBundledDistributionButton.addActionListener(myActionListener); buttonGroup.add(myUseBundledDistributionButton); //content.add(Box.createGlue(), ExternalSystemUiUtil.getFillLineConstraints(indentLevel)); content.add(myUseBundledDistributionButton, ExternalSystemUiUtil.getFillLineConstraints(indentLevel)); } return this; }
@Nullable @Override protected JComponent createCenterPanel() { JPanel panel = new JPanel(new GridBagLayout()); GridBag gb = new GridBag(). setDefaultAnchor(GridBagConstraints.LINE_START). setDefaultInsets(0, UIUtil.DEFAULT_HGAP, UIUtil.LARGE_VGAP, 0); String description = prepareDescription(myProject, myCommits); panel.add(new JBLabel(XmlStringUtil.wrapInHtml(description)), gb.nextLine().next().coverLine()); String explanation = "This will reset the current branch head to the selected commit, <br/>" + "and update the working tree and the index according to the selected mode:"; panel.add(new JBLabel(XmlStringUtil.wrapInHtml(explanation), UIUtil.ComponentStyle.SMALL), gb.nextLine().next().coverLine()); for (GitResetMode mode : GitResetMode.values()) { JBRadioButton button = new JBRadioButton(mode.getName()); button.setMnemonic(mode.getName().charAt(0)); myButtonGroup.add(button); panel.add(button, gb.nextLine().next()); panel.add(new JBLabel(XmlStringUtil.wrapInHtml(mode.getDescription()), UIUtil.ComponentStyle.SMALL), gb.next()); } myEnumModel = RadioButtonEnumModel.bindEnum(GitResetMode.class, myButtonGroup); myEnumModel.setSelected(myDefaultMode); return panel; }
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(); }
private static void register(@NotNull JBRadioButton choice, @NotNull SvnConfiguration.SshConnectionType value) { choice.putClientProperty("value", value); }
private static void setSelected(@NotNull JBRadioButton choice, @NotNull SvnConfiguration.SshConnectionType value) { choice.setSelected(value.equals(choice.getClientProperty("value"))); }