Java 类com.intellij.ui.components.panels.HorizontalLayout 实例源码

项目:jfrog-idea-plugin    文件:DetailsViewFactory.java   
private static void addLicenses(JPanel panel, Set<License> licenses) {
    if (licenses == null) {
        return;
    }
    JPanel licensesPanel = new JBPanel(new HorizontalLayout(1));
    licensesPanel.setBackground(UIUtil.getTableBackground());
    for (License license : licenses) {
        if (CollectionUtils.isEmpty(license.moreInfoUrl)) {
            licensesPanel.add(createJTextArea(createLicenseString(license), false));
            continue;
        }
        HyperlinkLabel hyperlinkLabel = new HyperlinkLabel(createLicenseString(license));
        hyperlinkLabel.setBackground(UIUtil.getTableBackground());
        hyperlinkLabel.setHyperlinkTarget(license.moreInfoUrl.get(0));
        licensesPanel.add(hyperlinkLabel);
    }

    JBLabel headerLabel = new JBLabel("Licenses:");
    headerLabel.setBackground(UIUtil.getTableBackground());
    headerLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));

    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.ipadx = 20;
    c.ipady = 3;

    c.gridy = 4;
    panel.add(headerLabel, c);

    c.gridx = 1;
    c.weightx = 0.9;
    panel.add(licensesPanel, c);
}
项目:intellij-ce-playground    文件:Banner.java   
Banner(Action action) {
  super(new BorderLayout(10, 0));
  myLeftPanel.setLayout(new HorizontalLayout(5));
  myProjectIcon.setIcon(AllIcons.General.ProjectConfigurableBanner);
  myProjectIcon.setForeground(JBColor.GRAY);
  myProjectIcon.setVisible(false);
  add(BorderLayout.WEST, myLeftPanel);
  add(BorderLayout.CENTER, myProjectIcon);
  add(BorderLayout.EAST, RelativeFont.BOLD.install(new SwingActionLink(action)));
}
项目:intellij-ce-playground    文件:DiffStatusBar.java   
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));
  }
}
项目:intellij-ce-playground    文件:ColorBlindnessPanel.java   
public ColorBlindnessPanel() {
  super(new HorizontalLayout(JBUI.scale(10)));
  add(HorizontalLayout.LEFT, myCheckBox);
  add(HorizontalLayout.LEFT, myComboBox);

  JLabel label = new SwingActionLink(new AbstractAction(UIBundle.message("color.blindness.link.to.help")) {
    @Override
    public void actionPerformed(ActionEvent event) {
      HelpManager.getInstance().invokeHelp("Colorblind_Settings");
    }
  });
  add(HorizontalLayout.LEFT, label);

  myCheckBox.setSelected(false);
  myCheckBox.addChangeListener(this);
  myCheckBox.setText(UIBundle.message("color.blindness.checkbox.text"));
  int count = 0;
  for (ColorBlindness blindness : ColorBlindness.values()) {
    String name = UIBundle.message(blindness.key);
    if (!name.isEmpty()) {
      myComboBox.addItem(new Item(blindness, name));
      count++;
    }
  }
  myComboBox.setEnabled(false);
  myComboBox.setVisible(count > 1);
  setVisible(count > 0);
}
项目:intellij-ce-playground    文件:IpnbCodeSourcePanel.java   
public IpnbCodeSourcePanel(@NotNull final Project project, @NotNull final IpnbCodePanel parent, @NotNull final IpnbCodeCell cell) {
  super(cell, new HorizontalLayout(5));
  myProject = project;
  myParent = parent;
  mySource = cell.getSourceAsString();
  final JComponent panel = createViewPanel();
  add(panel);
}
项目:consulo    文件:DiffStatusBar.java   
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));
  }
}
项目:intellij    文件:BlazeSelectOptionControl.java   
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;
}
项目:consulo    文件:BreadcrumbsConfigurable.java   
@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;
}