Java 类com.intellij.util.ui.GridBag 实例源码

项目:PackageTemplates    文件:SelectFileTemplateDialog.java   
@NotNull
private JPanel getOptionsPanel(final JPanel root) {
    JPanel options = new JPanel(new GridBagLayout());
    GridBag bag = new GridBag()
            .setDefaultInsets(new JBInsets(0, 4, 0, 4))
            .setDefaultFill(GridBagConstraints.HORIZONTAL);

    cbAddInternal = new JBCheckBox("Internal");
    cbAddJ2EE = new JBCheckBox("J2EE");

    ItemListener itemListener = e -> {
        root.remove(comboBox);
        comboBox = getSelector();
        root.add(comboBox);
        root.revalidate();
    };

    cbAddInternal.addItemListener(itemListener);
    cbAddJ2EE.addItemListener(itemListener);

    options.add(cbAddInternal, bag.nextLine().next());
    options.add(cbAddJ2EE, bag.next());
    return options;
}
项目:intellij-ce-playground    文件:LiveTemplateSettingsEditor.java   
@NotNull
private JComponent createNorthPanel() {
  JPanel panel = new JPanel(new GridBagLayout());

  GridBag gb = new GridBag().setDefaultInsets(4, 4, 4, 4).setDefaultWeightY(1).setDefaultFill(GridBagConstraints.BOTH);

  JLabel keyPrompt = new JLabel(CodeInsightBundle.message("dialog.edit.template.label.abbreviation"));
  keyPrompt.setLabelFor(myKeyField);
  panel.add(keyPrompt, gb.nextLine().next());

  panel.add(myKeyField, gb.next().weightx(1));

  JLabel descriptionPrompt = new JLabel(CodeInsightBundle.message("dialog.edit.template.label.description"));
  descriptionPrompt.setLabelFor(myDescription);
  panel.add(descriptionPrompt, gb.next());

  panel.add(myDescription, gb.next().weightx(3));
  return panel;
}
项目:intellij-ce-playground    文件:Advertiser.java   
public Advertiser() {
  myNextLabel = new JLabel(">>");
  myNextLabel.setFont(adFont().deriveFont(
    ContainerUtil.<TextAttribute, Object>immutableMapBuilder().put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON).build()));
  myNextLabel.setForeground(JBColor.blue);
  new ClickListener() {
    @Override
    public boolean onClick(@NotNull MouseEvent e, int clickCount) {
      myCurrentItem++;
      updateAdvertisements();
      return true;
    }
  }.installOn(myNextLabel);

  myNextLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

  GridBag gb = new GridBag();
  myComponent.add(myTextPanel, gb.next());
  myComponent.add(myNextLabel, gb.next());
  myComponent.add(new NonOpaquePanel(), gb.next().fillCellHorizontally().weightx(1));
}
项目:intellij-ce-playground    文件:ArrangementGroupingRulesPanel.java   
public ArrangementGroupingRulesPanel(@NotNull ArrangementStandardSettingsManager settingsManager,
                                     @NotNull ArrangementColorsProvider colorsProvider)
{
  super(new GridBagLayout());

  myControl = new ArrangementGroupingRulesControl(settingsManager, colorsProvider);

  TitleWithToolbar top = new TitleWithToolbar(
    ApplicationBundle.message("arrangement.settings.section.groups"),
    ArrangementConstants.ACTION_GROUP_GROUPING_RULES_CONTROL_TOOLBAR,
    ArrangementConstants.GROUPING_RULES_CONTROL_TOOLBAR_PLACE,
    myControl
  );

  add(top, new GridBag().coverLine().fillCellHorizontally().weightx(1));
  add(myControl, new GridBag().fillCell().weightx(1).weighty(1).insets(0, ArrangementConstants.HORIZONTAL_PADDING, 0, 0));
}
项目:intellij-ce-playground    文件:ArrangementGroupingComponent.java   
private void init() {
  setLayout(new GridBagLayout());
  add(myRowIndexControl,
      new GridBag().anchor(GridBagConstraints.CENTER)
        .insets(0, ArrangementConstants.HORIZONTAL_PADDING, 0, ArrangementConstants.HORIZONTAL_GAP * 2)
  );
  add(myGroupingTypeToken.getUiComponent(), new GridBag().anchor(GridBagConstraints.WEST).insets(0, 0, 0, 2));
  if (myOrderTypeToken != null) {
    add(myOrderTypeToken.getUiComponent(), new GridBag().anchor(GridBagConstraints.WEST));
  }
  add(new JLabel(" "), new GridBag().weightx(1).fillCellHorizontally());

  setBackground(UIUtil.getListBackground());
  setBorder(IdeBorderFactory.createEmptyBorder(ArrangementConstants.VERTICAL_GAP));
  setOpaque(!UIUtil.isUnderIntelliJLaF() && !UIUtil.isUnderNativeMacLookAndFeel() && !UIUtil.isUnderDarcula());
}
项目:intellij-ce-playground    文件:ExternalDependencyEntityUi.java   
MyComponent() {
  super(new GridBagLayout());
  setBackground(GradleEditorUiConstants.BACKGROUND_COLOR);
  editorVersion.setBackground(GradleEditorUiConstants.BACKGROUND_COLOR);
  editorVersion.setEditable(true);
  GridBag constraints = new GridBag().anchor(GridBagConstraints.WEST);
  add(mySimpleScope, constraints);
  add(myRefScope, constraints);
  add(new JBLabel(" "), constraints); // Separate scope from group
  add(mySimpleGroup, constraints);
  add(myRefGroup, constraints);
  add(new JBLabel(":"), constraints);
  add(mySimpleArtifact, constraints);
  add(myRefArtifact, constraints);
  add(new JBLabel(":"), constraints);
  add(mySimpleVersion, constraints);
  add(myRefVersion, constraints);
  add(editorVersion, constraints);
}
项目:intellij-ce-playground    文件:ConstructorCountInspection.java   
@Override
public JComponent createOptionsPanel() {
  final JLabel label = new JLabel(getConfigurationLabel());
  final JFormattedTextField valueField = prepareNumberEditor("m_limit");
  final CheckBox includeCheckBox =
    new CheckBox(InspectionGadgetsBundle.message("too.many.constructors.ignore.deprecated.option"), this, "ignoreDeprecatedConstructors");

  final GridBag bag = new GridBag();
  bag.setDefaultInsets(0, 0, 0, UIUtil.DEFAULT_HGAP);
  bag.setDefaultAnchor(GridBagConstraints.WEST);
  final JPanel panel = new JPanel(new GridBagLayout());
  panel.add(label, bag.nextLine().next());
  panel.add(valueField, bag.next().weightx(1.0));
  panel.add(includeCheckBox, bag.nextLine().next().coverLine().weighty(1.0).anchor(GridBagConstraints.NORTHWEST));
  return panel;
}
项目:intellij-ce-playground    文件:GroovyIntroduceVariableDialog.java   
private JPanel createNamePanel() {
  final GridBag c = new GridBag().setDefaultAnchor(GridBagConstraints.WEST).setDefaultInsets(1, 1, 1, 1);
  final JPanel namePanel = new JPanel(new GridBagLayout());

  final JLabel typeLabel = new JLabel(UIUtil.replaceMnemonicAmpersand("&Type:"));
  c.nextLine().next().weightx(0).fillCellNone();
  namePanel.add(typeLabel, c);

  myTypeComboBox = GrTypeComboBox.createTypeComboBoxFromExpression(myExpression, GroovyApplicationSettings.getInstance().INTRODUCE_LOCAL_SELECT_DEF);
  c.next().weightx(1).fillCellHorizontally();
  namePanel.add(myTypeComboBox, c);
  typeLabel.setLabelFor(myTypeComboBox);

  final JLabel nameLabel = new JLabel(UIUtil.replaceMnemonicAmpersand("&Name:"));
  c.nextLine().next().weightx(0).fillCellNone();
  namePanel.add(nameLabel, c);

  myNameField = setUpNameComboBox();
  c.next().weightx(1).fillCellHorizontally();
  namePanel.add(myNameField, c);
  nameLabel.setLabelFor(myNameField);

  GrTypeComboBox.registerUpDownHint(myNameField, myTypeComboBox);
  return namePanel;
}
项目:intellij-ce-playground    文件:GrIntroduceParameterDialog.java   
private JPanel createNamePanel() {
  final GridBag c = new GridBag().setDefaultAnchor(GridBagConstraints.WEST).setDefaultInsets(1, 1, 1, 1);
  final JPanel namePanel = new JPanel(new GridBagLayout());

  final JLabel typeLabel = new JLabel(UIUtil.replaceMnemonicAmpersand("&Type:"));
  c.nextLine().next().weightx(0).fillCellNone();
  namePanel.add(typeLabel, c);

  myTypeComboBox = createTypeComboBox(GroovyIntroduceParameterUtil.findVar(myInfo), GroovyIntroduceParameterUtil.findExpr(myInfo), findStringPart());
  c.next().weightx(1).fillCellHorizontally();
  namePanel.add(myTypeComboBox, c);
  typeLabel.setLabelFor(myTypeComboBox);

  final JLabel nameLabel = new JLabel(UIUtil.replaceMnemonicAmpersand("&Name:"));
  c.nextLine().next().weightx(0).fillCellNone();
  namePanel.add(nameLabel, c);

  myNameSuggestionsField = createNameField(GroovyIntroduceParameterUtil.findVar(myInfo));
  c.next().weightx(1).fillCellHorizontally();
  namePanel.add(myNameSuggestionsField, c);
  nameLabel.setLabelFor(myNameSuggestionsField);

  GrTypeComboBox.registerUpDownHint(myNameSuggestionsField, myTypeComboBox);

  return namePanel;
}
项目:intellij-pants-plugin    文件:PantsProjectSettingsControl.java   
@Override
protected void fillExtraControls(@NotNull PaintAwarePanel content, int indentLevel) {

  myLibsWithSourcesCheckBox.setSelected(mySettings.isLibsWithSources());
  myEnableIncrementalImportCheckBox.setSelected(mySettings.isEnableIncrementalImport());
  myUseIdeaProjectJdkCheckBox.setSelected(mySettings.isUseIdeaProjectJdk());

  mySettings.getTargetSpecs().forEach(spec -> myTargetSpecsBox.addItem(spec, spec, true));

  List<JComponent> boxes = ContainerUtil.newArrayList(
    myLibsWithSourcesCheckBox,
    myEnableIncrementalImportCheckBox,
    myUseIdeaProjectJdkCheckBox,
    new JBLabel(PantsBundle.message("pants.settings.text.targets")),
    new JBScrollPane(myTargetSpecsBox)
  );

  GridBag lineConstraints = ExternalSystemUiUtil.getFillLineConstraints(indentLevel);

  for (JComponent component : boxes) {
    content.add(component, lineConstraints);
  }
}
项目:tools-idea    文件:LiveTemplateSettingsEditor.java   
@Nullable
private JComponent createNorthPanel() {
  JPanel panel = new JPanel(new GridBagLayout());

  GridBag gb = new GridBag().setDefaultInsets(4, 4, 4, 4).setDefaultWeightY(1).setDefaultFill(GridBagConstraints.BOTH);

  JLabel keyPrompt = new JLabel(CodeInsightBundle.message("dialog.edit.template.label.abbreviation"));
  keyPrompt.setLabelFor(myKeyField);
  panel.add(keyPrompt, gb.nextLine().next());

  panel.add(myKeyField, gb.next().weightx(1));

  JLabel descriptionPrompt = new JLabel(CodeInsightBundle.message("dialog.edit.template.label.description"));
  descriptionPrompt.setLabelFor(myDescription);
  panel.add(descriptionPrompt, gb.next());

  panel.add(myDescription, gb.next().weightx(3));
  return panel;
}
项目:tools-idea    文件:Advertiser.java   
public Advertiser() {
  myNextLabel = new JLabel(">>");
  myNextLabel.setFont(adFont().deriveFont(
    ContainerUtil.<TextAttribute, Object>immutableMapBuilder().put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON).build()));
  myNextLabel.setForeground(JBColor.blue);
  new ClickListener() {
    @Override
    public boolean onClick(MouseEvent e, int clickCount) {
      myCurrentItem++;
      updateAdvertisements();
      return true;
    }
  }.installOn(myNextLabel);

  myNextLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

  GridBag gb = new GridBag();
  myComponent.add(myTextPanel, gb.next());
  myComponent.add(myNextLabel, gb.next());
  myComponent.add(new NonOpaquePanel(), gb.next().fillCellHorizontally().weightx(1));
}
项目:tools-idea    文件:ArrangementGroupingRulesPanel.java   
public ArrangementGroupingRulesPanel(@NotNull ArrangementStandardSettingsManager settingsManager,
                                     @NotNull ArrangementColorsProvider colorsProvider)
{
  super(new GridBagLayout());

  myControl = new ArrangementGroupingRulesControl(settingsManager, colorsProvider);

  TitleWithToolbar top = new TitleWithToolbar(
    ApplicationBundle.message("arrangement.settings.section.groups"),
    ArrangementConstants.ACTION_GROUP_GROUPING_RULES_CONTROL_TOOLBAR,
    ArrangementConstants.GROUPING_RULES_CONTROL_TOOLBAR_PLACE,
    myControl
  );

  add(top, new GridBag().coverLine().fillCellHorizontally().weightx(1));
  add(myControl, new GridBag().fillCell().weightx(1).weighty(1).insets(0, ArrangementConstants.HORIZONTAL_PADDING, 0, 0));
}
项目:tools-idea    文件:GitManualPushToBranch.java   
private void layoutComponents() {
  JPanel panel = new JPanel();
  GridBagLayout layout = new GridBagLayout();
  panel.setLayout(layout);
  GridBag g = new GridBag()
    .setDefaultFill(GridBagConstraints.NONE)
    .setDefaultAnchor(GridBagConstraints.BASELINE_LEADING)
    .setDefaultWeightX(1, 1)
    .setDefaultInsets(new Insets(0, 0, UIUtil.DEFAULT_VGAP, 5))
  ;

  panel.add(myManualPush, g.nextLine().next());
  panel.add(myRemoteSelectorComponent, g.next());
  panel.add(myDestBranchTextField, g.next());
  panel.add(myRefreshButton, g.next());
  if (myRepositories.size() > 1) {
    panel.add(myComment, g.nextLine().insets(0, 28, 0, 0).coverLine());
  }

  setLayout(new BorderLayout());
  add(panel, BorderLayout.WEST);
}
项目:tools-idea    文件:HgBookmarkDialog.java   
@Override
@NotNull
protected JComponent createCenterPanel() {

  JPanel contentPanel = new JPanel(new GridBagLayout());
  GridBag g = new GridBag()
    .setDefaultInsets(new Insets(0, 0, DEFAULT_VGAP, DEFAULT_HGAP))
    .setDefaultAnchor(GridBagConstraints.LINE_START)
    .setDefaultFill(GridBagConstraints.HORIZONTAL);

  JLabel icon = new JLabel(UIUtil.getQuestionIcon(), SwingConstants.LEFT);
  myBookmarkName = new JBTextField(13);

  JBLabel bookmarkLabel = new JBLabel("Bookmark name:");
  bookmarkLabel.setLabelFor(myBookmarkName);

  myActiveCheckbox = new JBCheckBox("Inactive", false);

  contentPanel.add(icon, g.nextLine().next().coverColumn(3).pady(DEFAULT_HGAP));
  contentPanel.add(bookmarkLabel, g.next().fillCellNone().insets(new Insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP)));
  contentPanel.add(myBookmarkName, g.next().coverLine().setDefaultWeightX(1));
  contentPanel.add(myActiveCheckbox, g.nextLine().next().next().coverLine(2));
  return contentPanel;
}
项目:tools-idea    文件:ConstructorCountInspection.java   
@Override
public JComponent createOptionsPanel() {
  final JLabel label = new JLabel(getConfigurationLabel());
  final JFormattedTextField valueField = prepareNumberEditor("m_limit");
  final CheckBox includeCheckBox =
    new CheckBox(InspectionGadgetsBundle.message("too.many.constructors.ignore.deprecated.option"), this, "ignoreDeprecatedConstructors");

  final GridBag bag = new GridBag();
  bag.setDefaultInsets(0, 0, 0, UIUtil.DEFAULT_HGAP);
  bag.setDefaultAnchor(GridBagConstraints.WEST);
  final JPanel panel = new JPanel(new GridBagLayout());
  panel.add(label, bag.nextLine().next());
  panel.add(valueField, bag.next().weightx(1.0));
  panel.add(includeCheckBox, bag.nextLine().next().coverLine().weighty(1.0).anchor(GridBagConstraints.NORTHWEST));
  return panel;
}
项目:tools-idea    文件:GroovyIntroduceVariableDialog.java   
private JPanel createNamePanel() {
  final GridBag c = new GridBag().setDefaultAnchor(GridBagConstraints.WEST).setDefaultInsets(1, 1, 1, 1);
  final JPanel namePanel = new JPanel(new GridBagLayout());

  final JLabel typeLabel = new JLabel(UIUtil.replaceMnemonicAmpersand("&Type:"));
  c.nextLine().next().weightx(0).fillCellNone();
  namePanel.add(typeLabel, c);

  myTypeComboBox = GrTypeComboBox.createTypeComboBoxFromExpression(myExpression, GroovyApplicationSettings.getInstance().INTRODUCE_LOCAL_SELECT_DEF);
  c.next().weightx(1).fillCellHorizontally();
  namePanel.add(myTypeComboBox, c);
  typeLabel.setLabelFor(myTypeComboBox);

  final JLabel nameLabel = new JLabel(UIUtil.replaceMnemonicAmpersand("&Name:"));
  c.nextLine().next().weightx(0).fillCellNone();
  namePanel.add(nameLabel, c);

  myNameField = setUpNameComboBox();
  c.next().weightx(1).fillCellHorizontally();
  namePanel.add(myNameField, c);
  nameLabel.setLabelFor(myNameField);

  GrTypeComboBox.registerUpDownHint(myNameField, myTypeComboBox);
  return namePanel;
}
项目:tools-idea    文件:GrIntroduceParameterDialog.java   
private JPanel createNamePanel() {
  final GridBag c = new GridBag().setDefaultAnchor(GridBagConstraints.WEST).setDefaultInsets(1, 1, 1, 1);
  final JPanel namePanel = new JPanel(new GridBagLayout());

  final JLabel typeLabel = new JLabel(UIUtil.replaceMnemonicAmpersand("&Type:"));
  c.nextLine().next().weightx(0).fillCellNone();
  namePanel.add(typeLabel, c);

  myTypeComboBox = createTypeComboBox(findVar(), findExpr(), findStringPart());
  c.next().weightx(1).fillCellHorizontally();
  namePanel.add(myTypeComboBox, c);
  typeLabel.setLabelFor(myTypeComboBox);

  final JLabel nameLabel = new JLabel(UIUtil.replaceMnemonicAmpersand("&Name:"));
  c.nextLine().next().weightx(0).fillCellNone();
  namePanel.add(nameLabel, c);

  myNameSuggestionsField = createNameField(findVar());
  c.next().weightx(1).fillCellHorizontally();
  namePanel.add(myNameSuggestionsField, c);
  nameLabel.setLabelFor(myNameSuggestionsField);

  GrTypeComboBox.registerUpDownHint(myNameSuggestionsField, myTypeComboBox);

  return namePanel;
}
项目:Crucible4IDEA    文件:CommentNodeRenderer.java   
CommentRendererPanel() {
  super(new BorderLayout());
  setOpaque(false);

  myIconLabel = new JBLabel();
  myMessageLabel = new JBLabel();
  myMessageLabel.setOpaque(false);

  JPanel actionsPanel = new JPanel();
  myPostLink = new LinkLabel("Publish", null);
  actionsPanel.add(myPostLink);

  myMainPanel = new JPanel(new GridBagLayout());
  GridBag bag = new GridBag()
    .setDefaultInsets(UIUtil.DEFAULT_VGAP, UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP, UIUtil.DEFAULT_HGAP)
    .setDefaultPaddingY(UIUtil.DEFAULT_VGAP);
  myMainPanel.add(myIconLabel, bag.next().coverColumn().anchor(GridBagConstraints.NORTHWEST).weightx(0.1));
  myMainPanel.add(myMessageLabel, bag.next().fillCell().anchor(GridBagConstraints.NORTH).weightx(1.0));
  myMainPanel.add(myPostLink, bag.nextLine().anchor(GridBagConstraints.SOUTHEAST));

  add(myMainPanel);
}
项目:consulo    文件:LiveTemplateSettingsEditor.java   
@Nullable
private JComponent createNorthPanel() {
  JPanel panel = new JPanel(new GridBagLayout());

  GridBag gb = new GridBag().setDefaultInsets(4, 4, 4, 4).setDefaultWeightY(1).setDefaultFill(GridBagConstraints.BOTH);

  JLabel keyPrompt = new JLabel(CodeInsightBundle.message("dialog.edit.template.label.abbreviation"));
  keyPrompt.setLabelFor(myKeyField);
  panel.add(keyPrompt, gb.nextLine().next());

  panel.add(myKeyField, gb.next().weightx(1));

  JLabel descriptionPrompt = new JLabel(CodeInsightBundle.message("dialog.edit.template.label.description"));
  descriptionPrompt.setLabelFor(myDescription);
  panel.add(descriptionPrompt, gb.next());

  panel.add(myDescription, gb.next().weightx(3));
  return panel;
}
项目:consulo    文件:Advertiser.java   
public Advertiser() {
  myNextLabel = new JLabel(">>");
  myNextLabel.setFont(adFont().deriveFont(
    ContainerUtil.<TextAttribute, Object>immutableMapBuilder().put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON).build()));
  myNextLabel.setForeground(JBColor.blue);
  new ClickListener() {
    @Override
    public boolean onClick(MouseEvent e, int clickCount) {
      myCurrentItem++;
      updateAdvertisements();
      return true;
    }
  }.installOn(myNextLabel);

  myNextLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

  GridBag gb = new GridBag();
  myComponent.add(myTextPanel, gb.next());
  myComponent.add(myNextLabel, gb.next());
  myComponent.add(new NonOpaquePanel(), gb.next().fillCellHorizontally().weightx(1));
}
项目:consulo    文件:ArrangementGroupingRulesPanel.java   
public ArrangementGroupingRulesPanel(@Nonnull ArrangementStandardSettingsManager settingsManager,
                                     @Nonnull ArrangementColorsProvider colorsProvider)
{
  super(new GridBagLayout());

  myControl = new ArrangementGroupingRulesControl(settingsManager, colorsProvider);

  TitleWithToolbar top = new TitleWithToolbar(
          ApplicationBundle.message("arrangement.settings.section.groups"),
          ArrangementConstants.ACTION_GROUP_GROUPING_RULES_CONTROL_TOOLBAR,
          ArrangementConstants.GROUPING_RULES_CONTROL_TOOLBAR_PLACE,
          myControl
  );

  add(top, new GridBag().coverLine().fillCellHorizontally().weightx(1));
  add(myControl, new GridBag().fillCell().weightx(1).weighty(1).insets(0, ArrangementConstants.HORIZONTAL_PADDING, 0, 0));
}
项目:consulo-java    文件:ConstructorCountInspection.java   
@Override
public JComponent createOptionsPanel() {
  final JLabel label = new JLabel(getConfigurationLabel());
  final JFormattedTextField valueField = prepareNumberEditor("m_limit");
  final CheckBox includeCheckBox =
    new CheckBox(InspectionGadgetsBundle.message("too.many.constructors.ignore.deprecated.option"), this, "ignoreDeprecatedConstructors");

  final GridBag bag = new GridBag();
  bag.setDefaultInsets(0, 0, 0, UIUtil.DEFAULT_HGAP);
  bag.setDefaultAnchor(GridBagConstraints.WEST);
  final JPanel panel = new JPanel(new GridBagLayout());
  panel.add(label, bag.nextLine().next());
  panel.add(valueField, bag.next().weightx(1.0));
  panel.add(includeCheckBox, bag.nextLine().next().coverLine().weighty(1.0).anchor(GridBagConstraints.NORTHWEST));
  return panel;
}
项目:PackageTemplates    文件:GridBagFactory.java   
public static GridBag getBagForPackageTemplate() {
    return new GridBag()
            .setDefaultInsets(defaultInsets)
            .setDefaultFill(GridBagConstraints.HORIZONTAL)
            .setDefaultWeightX(0, 0)
            .setDefaultWeightX(1, 1);
}
项目:PackageTemplates    文件:GridBagFactory.java   
public static GridBag getBagForDirectory() {
    return new GridBag()
            .setDefaultWeightX(0, 0)
            .setDefaultWeightX(1, 1)
            .setDefaultInsets(defaultInsets)
            .setDefaultFill(GridBagConstraints.HORIZONTAL);
}
项目:PackageTemplates    文件:GridBagFactory.java   
public static GridBag getOptionsPanelGridBag() {
    return new GridBag()
            .setDefaultWeightX(0, 0)
            .setDefaultWeightX(1, 0)
            .setDefaultWeightX(2, 1)
            .setDefaultFill(GridBagConstraints.HORIZONTAL);
}
项目:PackageTemplates    文件:ScriptDialog.java   
@Override
public void preShow() {
    panel.setLayout(new GridBagLayout());
    GridBag gridBag = GridBagFactory.getBagForScriptDialog();

    createEditorField();
    createViews();

    panel.add(etfCode, gridBag.nextLine().next().weighty(1).fillCell());
    panel.add(etfName, gridBag.nextLine().next());
    panel.add(btnTry, gridBag.nextLine().next().insets(4, 0, 4, 0));
    panel.add(jlResult, gridBag.nextLine().next());
}
项目:intellij-ce-playground    文件:ExternalProjectPathField.java   
public MyPathAndProjectButtonPanel(@NotNull EditorTextField textField,
                                   @NotNull FixedSizeButton registeredProjectsButton)
{
  super(new GridBagLayout());
  myTextField = textField;
  myRegisteredProjectsButton = registeredProjectsButton;
  add(myTextField, new GridBag().weightx(1).fillCellHorizontally());
  add(myRegisteredProjectsButton, new GridBag().insets(0, 3, 0, 0));
}
项目:intellij-ce-playground    文件:CustomizeDesktopEntryStep.java   
public CustomizeDesktopEntryStep(String iconPath) {
  setLayout(new BorderLayout());

  JPanel panel = createBigButtonPanel(createSmallBorderLayout(), myCreateEntryCheckBox, EmptyRunnable.INSTANCE);
  panel.setBorder(createSmallEmptyBorder());

  JPanel buttonPanel = new JPanel(new GridBagLayout());
  buttonPanel.setOpaque(false);

  GridBag gbc =
    new GridBag().setDefaultAnchor(GridBagConstraints.WEST).setDefaultFill(GridBagConstraints.HORIZONTAL).setDefaultWeightX(1);

  myCreateEntryCheckBox.setOpaque(false);
  buttonPanel.add(myCreateEntryCheckBox, gbc.nextLine());

  myGlobalEntryCheckBox.setOpaque(false);
  gbc.nextLine().insets.left = UIUtil.PANEL_REGULAR_INSETS.left;
  buttonPanel.add(myGlobalEntryCheckBox, gbc);

  panel.add(buttonPanel, BorderLayout.NORTH);

  JLabel label = new JLabel(IconLoader.getIcon(iconPath));
  label.setVerticalAlignment(JLabel.TOP);
  panel.add(label, BorderLayout.CENTER);

  add(panel, BorderLayout.CENTER);

  myCreateEntryCheckBox.addChangeListener(new ChangeListener() {
    @Override
    public void stateChanged(ChangeEvent e) {
      myGlobalEntryCheckBox.setEnabled(myCreateEntryCheckBox.isSelected());
      myGlobalEntryCheckBox.setSelected(myCreateEntryCheckBox.isSelected() && !PathManager.getHomePath().startsWith("/home"));
    }
  });

  myCreateEntryCheckBox.setSelected(true);
}
项目:intellij-ce-playground    文件:ArrangementRuleAliasesPanel.java   
public ArrangementRuleAliasesPanel(@NotNull ArrangementStandardSettingsManager settingsManager,
                                   @NotNull ArrangementColorsProvider colorsProvider) {
  super(new GridBagLayout());
  setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
  JBScrollPane scrollPane = new JBScrollPane();
  final JViewport viewport = scrollPane.getViewport();
  ArrangementMatchingRulesControl.RepresentationCallback callback = new ArrangementMatchingRulesControl.RepresentationCallback() {
    @Override
    public void ensureVisible(@NotNull Rectangle r) {
      Rectangle visibleRect = viewport.getViewRect();
      if (r.y <= visibleRect.y) {
        return;
      }

      int excessiveHeight = r.y + r.height - (visibleRect.y + visibleRect.height);
      if (excessiveHeight <= 0) {
        return;
      }

      int verticalShift = Math.min(r.y - visibleRect.y, excessiveHeight);
      if (verticalShift > 0) {
        viewport.setViewPosition(new Point(visibleRect.x, visibleRect.y + verticalShift));
      }
    }
  };
  myControl = new ArrangementRuleAliasControl(settingsManager, colorsProvider, callback);
  scrollPane.setViewportView(myControl);
  CustomizationUtil.installPopupHandler(
    myControl, ArrangementConstants.ALIAS_RULE_CONTEXT_MENU, ArrangementConstants.ALIAS_RULE_CONTROL_PLACE
  );

  TitleWithToolbar top = new TitleWithToolbar(
    ApplicationBundle.message("arrangement.settings.section.rule.sequence"),
    ArrangementConstants.ALIAS_RULE_CONTROL_TOOLBAR,
    ArrangementConstants.ALIAS_RULE_CONTROL_TOOLBAR_PLACE,
    myControl
  );
  add(top, new GridBag().coverLine().fillCellHorizontally().weightx(1));
  add(scrollPane, new GridBag().fillCell().weightx(1).weighty(1).insets(0, ArrangementConstants.HORIZONTAL_PADDING, 0, 0));
}
项目:intellij-ce-playground    文件:ArrangementMatchingRuleEditor.java   
@NotNull
private MultiRowFlowPanel addRowIfNecessary(@NotNull MultiRowFlowPanel panel) {
  if (panel.getComponentCount() <= 0) {
    return panel;
  }
  add(panel, new GridBag().anchor(GridBagConstraints.WEST).weightx(1).fillCellHorizontally().coverLine());
  myRows.add(panel);
  return new MultiRowFlowPanel(
    FlowLayout.LEFT, ArrangementConstants.HORIZONTAL_GAP, ArrangementConstants.VERTICAL_GAP
  );
}
项目:intellij-ce-playground    文件:ArrangementAnimationPanel.java   
public ArrangementAnimationPanel(@NotNull JComponent content, boolean expand, boolean horizontal) {
  super(new GridBagLayout());
  myContent = content;
  myExpand = expand;
  myHorizontal = horizontal;
  add(content, new GridBag().fillCell().weightx(1).weighty(1));
  setOpaque(false);
  setBackground(UIUtil.getListBackground());
  doLayout();
}
项目:intellij-ce-playground    文件:ArrangementListRowDecorator.java   
private void init() {
  setLayout(new GridBagLayout());
  GridBag constraints = new GridBag().anchor(GridBagConstraints.CENTER)
    .insets(0, ArrangementConstants.HORIZONTAL_PADDING, 0, ArrangementConstants.HORIZONTAL_GAP * 2);
  add(myRowIndexControl, constraints);
  add(new InsetsPanel(mySortLabel), new GridBag().anchor(GridBagConstraints.CENTER).insets(0, 0, 0, ArrangementConstants.HORIZONTAL_GAP));
  add(myDelegate.getUiComponent(), new GridBag().weightx(1).anchor(GridBagConstraints.WEST));
  add(myEditButton, new GridBag().anchor(GridBagConstraints.EAST));
  setBorder(IdeBorderFactory.createEmptyBorder(ArrangementConstants.VERTICAL_GAP));
}
项目:intellij-ce-playground    文件:TitleWithToolbar.java   
public TitleWithToolbar(@NotNull String title,
                        @NotNull String actionGroupId,
                        @NotNull String place,
                        @NotNull JComponent targetComponent)
{
  super(new GridBagLayout());
  ActionManager actionManager = ActionManager.getInstance();
  ActionGroup group = (ActionGroup)actionManager.getAction(actionGroupId);
  ActionToolbar actionToolbar = actionManager.createActionToolbar(place, group, true);
  actionToolbar.setTargetComponent(targetComponent);
  actionToolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);

  add(new MyTitleComponent(title), new GridBag().weightx(1).anchor(GridBagConstraints.WEST).fillCellHorizontally());
  add(actionToolbar.getComponent(), new GridBag().anchor(GridBagConstraints.CENTER));
}
项目:intellij-ce-playground    文件:GradleEditorCellComponentImpl.java   
public GradleEditorCellComponentImpl(@NotNull GradleEditorEntityTable table) {
  super(new GridBagLayout());
  myTable = table;
  add(myPayloadWrapper, myConstraints);
  myToolBarPanel.add(myHelpButton, myConstraints);
  myToolBarPanel.add(myNavigateButton, myConstraints);
  myToolBarPanel.add(myRemoveButton, myConstraints);
  myToolBarPanel.setVisible(false);
  add(myToolBarPanel, new GridBag().anchor(GridBagConstraints.WEST).insets(0, 16, 0, 0));
  add(myLabel, new GridBag().weightx(1).fillCellHorizontally());

  myConstraints.weightx(1);
}
项目:intellij-ce-playground    文件:SimpleGradleEntityUi.java   
MyComponent() {
  super(new GridBagLayout());
  GridBag constraints = new GridBag().anchor(GridBagConstraints.WEST);
  add(myName, constraints);
  add(editorSimpleValue, constraints);
  add(mySimpleValue, constraints.insets(0, GradleEditorUiConstants.VALUE_INSET, 0, 0));
  add(myRefValue, constraints);

  setBackground(GradleEditorUiConstants.BACKGROUND_COLOR);
  editorSimpleValue.setBackground(GradleEditorUiConstants.BACKGROUND_COLOR);
  editorSimpleValue.setEditable(true);

  addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {
      if (myTableRef == null) {
        return;
      }
      JTable table = myTableRef.get();
      if (table == null) {
        return;
      }
      Component c = SwingUtilities.getDeepestComponentAt(MyComponent.this, e.getX(), e.getY());
      if (c == null || (c != myRefValue && c != editorSimpleValue)) {
        Component editorComponent = table.getEditorComponent();
        if (editorComponent != null && UIUtil.isAncestor(editorComponent, MyComponent.this)) {
          table.getCellEditor().stopCellEditing();
        }
      }
    }
  });
}
项目:intellij-ce-playground    文件:GradleEditorComponent.java   
private void addUiForGroup(@NotNull String groupName, @NotNull JBPanel component, @NotNull GradleEditorEntityTable table) {
  GridBagConstraints constraints = new GridBag().weightx(1).anchor(GridBagConstraints.WEST).fillCellHorizontally().coverLine()
    .insets(8, 8, 8, 8);
  myCanvas.add(component, constraints);
  myTablesByGroupName.put(groupName, table);
  myPanelsByGroupName.put(groupName, component);
}
项目:intellij-ce-playground    文件:GitNewResetDialog.java   
@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;
}
项目:intellij-ce-playground    文件:GitDefineRemoteDialog.java   
@Nullable
@Override
protected JComponent createCenterPanel() {
  JPanel defineRemoteComponent = new JPanel(new GridBagLayout());
  GridBag gb = new GridBag().
    setDefaultAnchor(GridBagConstraints.LINE_START).
    setDefaultInsets(UIUtil.DEFAULT_VGAP, UIUtil.DEFAULT_HGAP, 0, 0);
  defineRemoteComponent.add(new JBLabel("Name:"), gb.nextLine().next().anchor(GridBagConstraints.EAST));
  defineRemoteComponent.add(myRemoteName, gb.next());
  defineRemoteComponent.add(new JBLabel("URL: "),
                            gb.nextLine().next().anchor(GridBagConstraints.EAST).insets(0, UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP, 0));
  defineRemoteComponent.add(myRemoteUrl, gb.next());
  return defineRemoteComponent;
}
项目:intellij-ce-playground    文件:GitCrlfDialog.java   
@Override
protected JComponent createCenterPanel() {
  JLabel description = new JBLabel(
    "<html>You are about to commit CRLF line separators to the Git repository.<br/>" +
    "It is recommended to set core.autocrlf Git attribute to <code>" + RECOMMENDED_VALUE +
    "</code> to avoid line separator issues.</html>");

  JLabel additionalDescription = new JBLabel(
    "<html>Fix and Commit: <code>git config --global core.autocrlf " + RECOMMENDED_VALUE + "</code> will be called,<br/>" +
    "Commit as Is: the config value won't be set.</html>", UIUtil.ComponentStyle.SMALL);

  JLabel readMore = new LinkLabel("Read more", null, new LinkListener() {
    @Override
    public void linkSelected(LinkLabel aSource, Object aLinkData) {
      BrowserUtil.browse("https://help.github.com/articles/dealing-with-line-endings");
    }
  });

  JLabel icon = new JLabel(UIUtil.getWarningIcon(), SwingConstants.LEFT);
  myDontWarn = new JBCheckBox("Don't warn again");
  myDontWarn.setMnemonic('w');

  JPanel rootPanel = new JPanel(new GridBagLayout());
  GridBag g = new GridBag()
    .setDefaultInsets(new Insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP))
    .setDefaultAnchor(GridBagConstraints.LINE_START)
    .setDefaultFill(GridBagConstraints.HORIZONTAL);

  rootPanel.add(icon, g.nextLine().next().coverColumn(4));
  rootPanel.add(description, g.next());
  rootPanel.add(readMore, g.nextLine().next().next());
  rootPanel.add(additionalDescription, g.nextLine().next().next().pady(DEFAULT_HGAP));
  rootPanel.add(myDontWarn,  g.nextLine().next().next().insets(0, 0, 0, 0));

  return rootPanel;

}