com.intellij.ui.components.panels.HorizontalLayout Java Examples
The following examples show how to use
com.intellij.ui.components.panels.HorizontalLayout.
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: DiffStatusBar.java From consulo with Apache License 2.0 | 5 votes |
public <T extends LegendTypeDescriptor> DiffStatusBar(List<T> types) { super(new HorizontalLayout(10)); setBorder(BorderFactory.createEmptyBorder(5, 10, 10, 10)); add(HorizontalLayout.LEFT, myTextLabel); for (LegendTypeDescriptor type : types) { add(HorizontalLayout.CENTER, new LegendTypeLabel(type)); } }
Example #2
Source File: NotificationsManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
@Nullable private static JPanel createButtons(@Nonnull Notification notification, @Nonnull final JPanel content, @Nullable HyperlinkListener listener) { if (notification instanceof NotificationActionProvider) { JPanel buttons = new JPanel(new HorizontalLayout(5)); buttons.setOpaque(false); content.add(BorderLayout.SOUTH, buttons); final Ref<JButton> defaultButton = new Ref<>(); NotificationActionProvider provider = (NotificationActionProvider)notification; for (NotificationActionProvider.Action action : provider.getActions(listener)) { JButton button = new JButton(action); button.setOpaque(false); if (action.isDefaultAction()) { defaultButton.setIfNull(button); } buttons.add(HorizontalLayout.RIGHT, button); } if (!defaultButton.isNull()) { UIUtil.addParentChangeListener(content, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getOldValue() == null && event.getNewValue() != null) { UIUtil.removeParentChangeListener(content, this); JRootPane rootPane = UIUtil.getRootPane(content); if (rootPane != null) { rootPane.setDefaultButton(defaultButton.get()); } } } }); } return buttons; } return null; }
Example #3
Source File: BlazeSelectOptionControl.java From intellij with Apache License 2.0 | 4 votes |
BlazeSelectOptionControl(BlazeNewProjectBuilder builder, Collection<T> options) { this.userSettings = builder.getUserSettings(); JPanel canvas = new JPanel(new VerticalLayout(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(Borders.empty(20, 20, 0, 0)); JScrollPane scrollPane = new JBScrollPane(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.getDescription()); vertical.add(radioButton); JComponent optionComponent = option.getUiComponent(); if (optionComponent != null) { JPanel horizontal = new JPanel(new HorizontalLayout(0)); horizontal.setBorder(Borders.emptyLeft(25)); 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; }
Example #4
Source File: BreadcrumbsConfigurable.java From consulo with Apache License 2.0 | 4 votes |
@Override public JComponent createComponent() { if (component == null) { for (final BreadcrumbsProviderConfigurable configurable : getConfigurables()) { final String id = configurable.getId(); if (!map.containsKey(id)) { map.put(id, configurable.createComponent()); } } JPanel boxes = new JPanel(new GridLayout(0, 3, UIUtil.isUnderDarcula() ? JBUIScale.scale(10) : 0, 0)); map.values().stream().sorted((box1, box2) -> naturalCompare(box1.getText(), box2.getText())).forEach(box -> 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")); JPanel placementPanel = new JPanel(new HorizontalLayout(JBUIScale.scale(UIUtil.DEFAULT_HGAP))); 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(JBUIScale.scale(6))); languagesPanel.setBorder(JBUI.Borders.empty(0, 24, 12, 0)); languagesPanel.add(languages); languagesPanel.add(boxes); component = new JPanel(new VerticalLayout(JBUIScale.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); selectOrEditColor(context, "Breadcrumbs//Current", GeneralColorsPage.class); })); } return component; }