private void initUi() { bazelBinaryPath = FileSelectorWithStoredHistory.create( BlazeUserSettingsConfigurable.BAZEL_BINARY_PATH_KEY, "Specify the bazel binary path"); bazelBinaryPath.setText(getInitialBinaryPath()); bazelBinaryPath.setName("bazel-binary-path-field"); component = new JPanel(new VerticalLayout(4)); component.add(new JLabel("Select a bazel binary")); component.add(new JSeparator()); JPanel content = new JPanel(new VerticalLayout(12)); content.setBorder(new EmptyBorder(50, 100, 0, 100)); component.add(content); content.add(new JLabel("Specify a bazel binary to be used for all bazel projects")); content.add(bazelBinaryPath); }
AddSourceToProjectDialog(Project project, List<TargetInfo> targets) { super(project, /* canBeParent */ true, IdeModalityType.MODELESS); this.project = project; mainPanel = new JPanel(new VerticalLayout(12)); @SuppressWarnings({"rawtypes", "unchecked"}) // #api171: generify JBList usage JList<TargetInfo> targetsComponent = new JBList(targets); if (targets.size() == 1) { targetsComponent.setSelectedIndex(0); } this.targetsComponent = targetsComponent; setTitle("Add Source File to Project"); setupUi(); init(); }
@Nullable @Override public JComponent createComponent() { JPanel jPanel = new JPanel(); VerticalLayout verticalLayout = new VerticalLayout(1, 2); jPanel.setLayout(verticalLayout); jFilePickerClang = new JFilePicker("clang-format Path:", "..."); jLabeledCombox = new JLabeledCombox("Code Style: "); jCheckBox = new JCheckBox("Automatically show this page if clang-format is not found."); reset(); jFilePickerClang.getTextField().getDocument().addDocumentListener(listener); jLabeledCombox.getCombobox().addItemListener(combox_listener); jCheckBox.addActionListener(checkbox_listener); jPanel.add(jCheckBox); jPanel.add(jFilePickerClang); jPanel.add(jLabeledCombox); return jPanel; }
@Nullable @Override public JComponent createComponent() { JPanel result = new JPanel(new BorderLayout()); JPanel propertyTablePanel = new JPanel(new VerticalLayout(1)); propertyTablePanel.add(createIgnorePropertiesFilesTable()); propertyTablePanel.add(createExcludePropertiesFilesTable()); result.add(propertyTablePanel); return result; }
private void setupUi() { JPanel panel = new JPanel(new VerticalLayout(12)); panel.setBorder( IdeBorderFactory.createTitledBorder( String.format("Add %s target(s) to project", Blaze.buildSystemName(project)), false)); panel.add(targetsComponent); mainPanel.add(panel); }
BlazeSelectOptionControl(BlazeNewProjectBuilder builder, Collection<T> options) { if (options == null) { logger.error("No options on select screen '" + getTitle() + "'"); } this.userSettings = builder.getUserSettings(); JPanel canvas = new JPanel(new BorderLayout(0, 4)); canvas.setPreferredSize(ProjectViewUi.getContainerSize()); titleLabel = new JLabel(getTitle()); canvas.add(titleLabel); canvas.add(new JSeparator()); JPanel content = new JPanel(new VerticalLayout(12)); content.setBorder(new EmptyBorder(20, 100, 0, 0)); JScrollPane scrollPane = new JScrollPane(content); scrollPane.setBorder(BorderFactory.createEmptyBorder()); canvas.add(scrollPane); ButtonGroup buttonGroup = new ButtonGroup(); Collection<OptionUiEntry<T>> optionUiEntryList = Lists.newArrayList(); for (T option : options) { JPanel vertical = new JPanel(new VerticalLayout(10)); JRadioButton radioButton = new JRadioButton(); radioButton.setText(option.getOptionText()); vertical.add(radioButton); JComponent optionComponent = option.getUiComponent(); if (optionComponent != null) { JPanel horizontal = new JPanel(new HorizontalLayout(0)); horizontal.setBorder(new EmptyBorder(0, 25, 0, 0)); horizontal.add(optionComponent); vertical.add(horizontal); option.optionDeselected(); radioButton.addItemListener( itemEvent -> { if (radioButton.isSelected()) { option.optionSelected(); } else { option.optionDeselected(); } }); } content.add(vertical); buttonGroup.add(radioButton); optionUiEntryList.add(new OptionUiEntry<>(option, radioButton)); } OptionUiEntry selected = null; String previouslyChosenOption = userSettings.get(getOptionKey(), null); if (previouslyChosenOption != null) { for (OptionUiEntry<T> entry : optionUiEntryList) { if (entry.option.getOptionName().equals(previouslyChosenOption)) { selected = entry; break; } } } if (selected == null) { selected = Iterables.getFirst(optionUiEntryList, null); } if (selected != null) { selected.radioButton.setSelected(true); } this.canvas = canvas; this.optionUiEntryList = optionUiEntryList; }
@RequiredDispatchThread @Override public JComponent createComponent() { if (component == null) { for (BreadcrumbsProvider provider : BreadcrumbsProvider.EP_NAME.getExtensions()) { Language language = provider.getLanguage(); String id = language.getID(); if (!map.containsKey(id)) { map.put(id, new JCheckBox(language.getDisplayName())); } } JPanel boxes = new JPanel(new GridLayout(0, 3)); for (JCheckBox box : map.values()) boxes.add(box); show = new JCheckBox(message("checkbox.show.breadcrumbs")); show.addItemListener(event -> updateEnabled()); above = new JRadioButton(message("radio.show.breadcrumbs.above")); below = new JRadioButton(message("radio.show.breadcrumbs.below")); ButtonGroup group = new ButtonGroup(); group.add(above); group.add(below); placement = new JLabel(message("label.breadcrumbs.placement")); placement.setBorder(JBUI.Borders.emptyRight(12)); JPanel placementPanel = new JPanel(new HorizontalLayout(0)); placementPanel.setBorder(JBUI.Borders.emptyLeft(24)); placementPanel.add(placement); placementPanel.add(above); placementPanel.add(below); languages = new JLabel(message("label.breadcrumbs.languages")); JPanel languagesPanel = new JPanel(new VerticalLayout(JBUI.scale(6))); languagesPanel.setBorder(JBUI.Borders.empty(0, 24, 12, 0)); languagesPanel.add(languages); languagesPanel.add(boxes); component = new JPanel(new VerticalLayout(JBUI.scale(12), LEFT)); component.add(show); component.add(placementPanel); component.add(languagesPanel); component.add(LinkLabel.create(message("configure.breadcrumbs.colors"), () -> { DataContext context = DataManager.getInstance().getDataContext(component); ColorAndFontOptions.selectOrEditColor(context, "Breadcrumbs//Current", GeneralColorsPage.class); })); } return component; }