Java Code Examples for com.intellij.util.ui.UIUtil#DEFAULT_VGAP

The following examples show how to use com.intellij.util.ui.UIUtil#DEFAULT_VGAP . 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: HaxeRestoreReferencesDialog.java    From intellij-haxe with Apache License 2.0 6 votes vote down vote up
@Override
protected JComponent createCenterPanel() {
  final JPanel panel = new JPanel(new BorderLayout(UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP));
  myList = new JBList((Object[])myNamedElements);
  myList.setCellRenderer(new FQNameCellRenderer());
  panel.add(ScrollPaneFactory.createScrollPane(myList), BorderLayout.CENTER);

  panel.add(new JBLabel(CodeInsightBundle.message("dialog.paste.on.import.text"), SMALL, BRIGHTER), BorderLayout.NORTH);

  final JPanel buttonPanel = new JPanel(new VerticalFlowLayout());
  final JButton okButton = new JButton(CommonBundle.getOkButtonText());
  getRootPane().setDefaultButton(okButton);
  buttonPanel.add(okButton);
  final JButton cancelButton = new JButton(CommonBundle.getCancelButtonText());
  buttonPanel.add(cancelButton);

  panel.setPreferredSize(new Dimension(500, 400));

  return panel;
}
 
Example 2
Source File: AbstractFindUsagesDialog.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
protected JComponent createNorthPanel() {
  JPanel panel = new JPanel(new GridBagLayout());
  GridBagConstraints gbConstraints = new GridBagConstraints();

  gbConstraints.insets = new Insets(0, 0, UIUtil.DEFAULT_VGAP, 0);
  gbConstraints.fill = GridBagConstraints.NONE;
  gbConstraints.weightx = 1;
  gbConstraints.weighty = 1;
  gbConstraints.anchor = GridBagConstraints.WEST;
  final SimpleColoredComponent coloredComponent = new SimpleColoredComponent();
  coloredComponent.setIpad(new Insets(0,0,0,0));
  coloredComponent.setMyBorder(null);
  configureLabelComponent(coloredComponent);
  panel.add(coloredComponent, gbConstraints);

  return panel;
}
 
Example 3
Source File: IdeaTitledBorder.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public Insets getBorderInsets(Component c, final Insets insets) {
  insets.top += getTitledSeparator(c).getPreferredSize().getHeight() - TitledSeparator.TOP_INSET - TitledSeparator.BOTTOM_INSET;
  insets.top += UIUtil.DEFAULT_VGAP;
  insets.top += insideInsets.top;
  insets.left += insideInsets.left;
  insets.bottom += insideInsets.bottom;
  insets.right += insideInsets.right;
  insets.top += outsideInsets.top;
  insets.left += outsideInsets.left;
  insets.bottom += outsideInsets.bottom;
  insets.right += outsideInsets.right;
  return insets;
}
 
Example 4
Source File: OptionGroup.java    From consulo with Apache License 2.0 4 votes vote down vote up
public JPanel createPanel() {
  JPanel panel = new JPanel();
  panel.setLayout(new GridBagLayout());

  for (int i = 0; i < myOptions.size(); i++) {
    final int leftInset = Boolean.TRUE.equals(myIsShifted.get(i)) ? IdeBorderFactory.TITLED_BORDER_INDENT : 0;
    final int topInset = i == 0 ? 0 : UIUtil.DEFAULT_VGAP;
    final int rightInset = UIUtil.DEFAULT_HGAP;
    final Object option = myOptions.get(i);
    if (option instanceof JComponent) {
      JComponent component = (JComponent)option;
      panel.add(component,
                new GridBagConstraints(0, i, GridBagConstraints.REMAINDER, 1, 1, 0, GridBagConstraints.WEST, getFill(component),
                                       new Insets(topInset, leftInset, 0, 0), 0, 0));
    }
    else {
      Pair pair = (Pair)option;
      JComponent firstComponent = (JComponent)pair.first;
      panel.add(firstComponent,
                new GridBagConstraints(0, i, 1, 1, 1, 0, GridBagConstraints.WEST, getFill(firstComponent),
                                       new Insets(topInset, leftInset, 0, 0), 0, 0));
      JComponent secondComponent = (JComponent)pair.second;
      panel.add(secondComponent,
                new GridBagConstraints(1, i, 1, 1, 1, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL,
                                       new Insets(topInset, rightInset, 0, 0), 0, 0));
    }
  }
  JPanel p = new JPanel();
  p.setPreferredSize(new Dimension(0, 0));
  panel.add(p,
            new GridBagConstraints(0, myOptions.size(), GridBagConstraints.REMAINDER, 1, 0, 1,
                                   GridBagConstraints.NORTH, GridBagConstraints.NONE,
                                   new Insets(0, 0, 0, 0), 0, 0));

  if (myTitle != null) {
    IdeaTitledBorder titledBorder = IdeBorderFactory.createTitledBorder(myTitle, true);
    panel.setBorder(titledBorder);
    titledBorder.acceptMinimumSize(panel);
  }

  return panel;
}
 
Example 5
Source File: ApplyPatchDifferentiatedDialog.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
protected JComponent createCenterPanel() {
  if (myCenterPanel == null) {
    myCenterPanel = new JPanel(new GridBagLayout());
    final GridBagConstraints gb = new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.insets(1), 0, 0);

    myPatchFileLabel = new JLabel(VcsBundle.message("patch.apply.file.name.field"));
    myPatchFileLabel.setLabelFor(myPatchFile);
    myCenterPanel.add(myPatchFileLabel, gb);

    gb.fill = GridBagConstraints.HORIZONTAL;
    ++gb.gridy;
    myCenterPanel.add(myPatchFile, gb);

    final DefaultActionGroup group = new DefaultActionGroup();
    final AnAction[] treeActions = myChangesTreeList.getTreeActions();
    group.addAll(treeActions);
    group.add(new MapDirectory());

    final MyShowDiff diffAction = new MyShowDiff();
    diffAction.registerCustomShortcutSet(CommonShortcuts.getDiff(), getRootPane());
    group.add(diffAction);

    group.add(new StripUp());
    group.add(new StripDown());
    group.add(new ResetStrip());
    group.add(new ZeroStrip());
    if (myCanChangePatchFile) {
      group.add(new AnAction("Refresh", "Refresh", AllIcons.Actions.Refresh) {
        @Override
        public void actionPerformed(AnActionEvent e) {
          syncUpdatePatchFileAndScheduleReloadIfNeeded(null);
        }
      });
    }

    final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("APPLY_PATCH", group, true);
    ++gb.gridy;
    gb.fill = GridBagConstraints.HORIZONTAL;
    myCenterPanel.add(toolbar.getComponent(), gb);

    ++gb.gridy;
    gb.weighty = 1;
    gb.fill = GridBagConstraints.BOTH;
    myCenterPanel.add(ScrollPaneFactory.createScrollPane(myChangesTreeList), gb);

    ++gb.gridy;
    gb.weighty = 0;
    gb.fill = GridBagConstraints.NONE;
    gb.insets.bottom = UIUtil.DEFAULT_VGAP;
    myCenterPanel.add(myCommitLegendPanel.getComponent(), gb);

    ++gb.gridy;
    gb.fill = GridBagConstraints.HORIZONTAL;
    myCenterPanel.add(myChangeListChooser, gb);
  }
  return myCenterPanel;
}