當前位置: 首頁>>代碼示例>>Java>>正文


Java GridConstraints.setAnchor方法代碼示例

本文整理匯總了Java中com.intellij.uiDesigner.core.GridConstraints.setAnchor方法的典型用法代碼示例。如果您正苦於以下問題:Java GridConstraints.setAnchor方法的具體用法?Java GridConstraints.setAnchor怎麽用?Java GridConstraints.setAnchor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.uiDesigner.core.GridConstraints的用法示例。


在下文中一共展示了GridConstraints.setAnchor方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addComponent

import com.intellij.uiDesigner.core.GridConstraints; //導入方法依賴的package包/類
private static int addComponent(JComponent parent, JComponent component, int row, int column, boolean isLast) {
  GridConstraints gridConstraints = new GridConstraints();
  gridConstraints.setRow(row);
  gridConstraints.setColumn(column);

  boolean isGreedyComponent = component instanceof JTextField || component instanceof Spacer ||
                              component instanceof LabelWithEditLink || component instanceof TextAccessor ||
                              component instanceof EditorComboBox;

  int columnSpan = (isLast && isGreedyComponent) ? COLUMN_COUNT - column : 1;
  gridConstraints.setColSpan(columnSpan);
  gridConstraints.setAnchor(GridConstraints.ALIGN_LEFT);
  gridConstraints.setHSizePolicy(isGreedyComponent
                                 ? GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW
                                 : GridConstraints.SIZEPOLICY_CAN_SHRINK);
  gridConstraints.setVSizePolicy(component instanceof Spacer
                                 ? GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW
                                 : GridConstraints.SIZEPOLICY_FIXED);
  gridConstraints.setFill(GridConstraints.FILL_HORIZONTAL);
  parent.add(component, gridConstraints);
  if (isLast && !isGreedyComponent && column < COLUMN_COUNT - 1) {
    addComponent(parent, new Spacer(), row, column + 1, true);
  }

  return columnSpan;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:TemplateParameterStep2.java

示例2: setValueImpl

import com.intellij.uiDesigner.core.GridConstraints; //導入方法依賴的package包/類
protected void setValueImpl(final RadComponent component, final Integer value) throws Exception {
  int anchorMask = myHorizontal ? 0x0C : 3;
  int fillMask = myHorizontal ? 1 : 2;
  int anchor = 0;
  int fill = 0;
  switch(value.intValue()) {
    case GridConstraints.ALIGN_FILL:
      fill = myHorizontal ? GridConstraints.FILL_HORIZONTAL : GridConstraints.FILL_VERTICAL;
      break;
    case GridConstraints.ALIGN_LEFT:
      anchor = myHorizontal ? GridConstraints.ANCHOR_WEST : GridConstraints.ANCHOR_NORTH;
      break;
    case GridConstraints.ALIGN_RIGHT:
      anchor = myHorizontal ? GridConstraints.ANCHOR_EAST : GridConstraints.ANCHOR_SOUTH;
      break;
  }
  GridConstraints gc = component.getConstraints();
  GridConstraints oldGC = (GridConstraints) gc.clone();
  gc.setAnchor((gc.getAnchor() & ~anchorMask) | anchor);
  gc.setFill((gc.getFill() & ~fillMask) | fill);
  AlignPropertyProvider provider = getAlignPropertyProvider(component);
  if (provider != null) {
    provider.setAlignment(component, myHorizontal, value.intValue());
  }
  component.fireConstraintsChanged(oldGC);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:AlignProperty.java

示例3: createComponent

import com.intellij.uiDesigner.core.GridConstraints; //導入方法依賴的package包/類
@Nullable
@Override
public JComponent createComponent() {
    pluginEnabled = new JCheckBox("Enable plugin for this project");

    GridLayoutManager layout = new GridLayoutManager(2,1);
    GridConstraints c = new GridConstraints();
    c.setAnchor(GridConstraints.ANCHOR_NORTHWEST);

    JPanel panel1 = new JPanel(layout);
    panel1.add(pluginEnabled, c);
    return panel1;
}
 
開發者ID:cvette,項目名稱:intellij-neos,代碼行數:14,代碼來源:SettingsForm.java

示例4: HaxmAlert

import com.intellij.uiDesigner.core.GridConstraints; //導入方法依賴的package包/類
public HaxmAlert() {
  myErrorInstructionsLink = new HyperlinkLabel();
  myWarningMessage = new JBLabel() {
    @Override
    public Dimension getPreferredSize() {
      // Since this contains auto-wrapped text, the preferred height will not be set until repaint(). The below will set it as soon
      // as the actual width is known. This allows the wizard dialog to be set to the correct size even before this step is shown.
      final View view = (View)getClientProperty("html");
      Component parent = getParent();
      if (view != null && parent != null && parent.getWidth() > 0) {
        view.setSize(parent.getWidth(), 0);
        return new Dimension((int)view.getPreferredSpan(View.X_AXIS), (int)view.getPreferredSpan(View.Y_AXIS));
      }
      return super.getPreferredSize();
    }
  };
  this.setLayout(new GridLayoutManager(2, 1));
  GridConstraints constraints = new GridConstraints();
  constraints.setAnchor(GridConstraints.ANCHOR_WEST);
  add(myWarningMessage, constraints);
  constraints.setRow(1);
  add(myErrorInstructionsLink, constraints);
  myErrorInstructionsLink.setOpaque(false);
  myWarningMessage.setForeground(JBColor.RED);
  myWarningMessage.setHorizontalAlignment(SwingConstants.LEFT);
  setOpaque(false);
  this.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Recommendation"),
                                                    BorderFactory.createEmptyBorder(0, 5, 3, 5)));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:30,代碼來源:HaxmAlert.java

示例5: layout

import com.intellij.uiDesigner.core.GridConstraints; //導入方法依賴的package包/類
private void layout(JPanel panel, int row, int ident) {
  GridConstraints c = new GridConstraints();
  c.setVSizePolicy(GridConstraints.SIZEPOLICY_FIXED);
  c.setRow(row);
  c.setColumn(0);
  c.setFill(GridConstraints.FILL_NONE);
  c.setAnchor(GridConstraints.ANCHOR_WEST);
  c.setRow(row);
  c.setIndent(ident);
  panel.add(myLabel, c);
  c.setIndent(0);
  c.setColumn(1);
  c.setFill(GridConstraints.FILL_HORIZONTAL);
  panel.add(myMinSdkCombobox, c);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:16,代碼來源:ConfigureFormFactorStep.java

示例6: processDefaultConstraintsElement

import com.intellij.uiDesigner.core.GridConstraints; //導入方法依賴的package包/類
/**
 * Helper method.
 */
private static GridConstraints processDefaultConstraintsElement(@NotNull final Element element) {
  final GridConstraints constraints = new GridConstraints();

  // grid related attributes
  constraints.setVSizePolicy(LwXmlReader.getRequiredInt(element, ATTRIBUTE_VSIZE_POLICY));
  constraints.setHSizePolicy(LwXmlReader.getRequiredInt(element, ATTRIBUTE_HSIZE_POLICY));
  constraints.setAnchor(LwXmlReader.getRequiredInt(element, ATTRIBUTE_ANCHOR));
  constraints.setFill(LwXmlReader.getRequiredInt(element, ATTRIBUTE_FILL));

  // minimum size
  final Element minSizeElement = element.getChild(ELEMENT_MINIMUM_SIZE);
  if (minSizeElement != null) {
    constraints.myMinimumSize.width = LwXmlReader.getRequiredInt(minSizeElement, ATTRIBUTE_WIDTH);
    constraints.myMinimumSize.height = LwXmlReader.getRequiredInt(minSizeElement, ATTRIBUTE_HEIGHT);
  }

  // preferred size
  final Element prefSizeElement = element.getChild(ELEMENT_PREFERRED_SIZE);
  if (prefSizeElement != null) {
    constraints.myPreferredSize.width = LwXmlReader.getRequiredInt(prefSizeElement, ATTRIBUTE_WIDTH);
    constraints.myPreferredSize.height = LwXmlReader.getRequiredInt(prefSizeElement, ATTRIBUTE_HEIGHT);
  }

  // maximum size
  final Element maxSizeElement = element.getChild(ELEMENT_MAXIMUM_SIZE);
  if (maxSizeElement != null) {
    constraints.myMaximumSize.width = LwXmlReader.getRequiredInt(maxSizeElement, ATTRIBUTE_WIDTH);
    constraints.myMaximumSize.height = LwXmlReader.getRequiredInt(maxSizeElement, ATTRIBUTE_HEIGHT);
  }

  return constraints;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:36,代碼來源:Palette.java

示例7: readChildConstraints

import com.intellij.uiDesigner.core.GridConstraints; //導入方法依賴的package包/類
void readChildConstraints(final Element constraintsElement, final LwComponent component) {
  // Read Grid constraints
  final Element gridElement = LwXmlReader.getChild(constraintsElement, "grid");
  if(gridElement != null){
    final GridConstraints constraints=new GridConstraints();

    constraints.setRow(LwXmlReader.getRequiredInt(gridElement, "row"));
    constraints.setColumn(LwXmlReader.getRequiredInt(gridElement, "column"));
    constraints.setRowSpan(LwXmlReader.getRequiredInt(gridElement, "row-span"));
    constraints.setColSpan(LwXmlReader.getRequiredInt(gridElement, "col-span"));
    constraints.setVSizePolicy(LwXmlReader.getRequiredInt(gridElement, "vsize-policy"));
    constraints.setHSizePolicy(LwXmlReader.getRequiredInt(gridElement, "hsize-policy"));
    constraints.setAnchor(LwXmlReader.getRequiredInt(gridElement, "anchor"));
    constraints.setFill(LwXmlReader.getRequiredInt(gridElement, "fill"));
    constraints.setIndent(LwXmlReader.getOptionalInt(gridElement, UIFormXmlConstants.ATTRIBUTE_INDENT, 0));
    constraints.setUseParentLayout(LwXmlReader.getOptionalBoolean(gridElement, UIFormXmlConstants.ATTRIBUTE_USE_PARENT_LAYOUT, false));

    // minimum size
    final Element minSizeElement = LwXmlReader.getChild(gridElement, "minimum-size");
    if (minSizeElement != null) {
      constraints.myMinimumSize.width = LwXmlReader.getRequiredInt(minSizeElement, "width");
      constraints.myMinimumSize.height = LwXmlReader.getRequiredInt(minSizeElement, "height");
    }

    // preferred size
    final Element prefSizeElement = LwXmlReader.getChild(gridElement, "preferred-size");
    if (prefSizeElement != null) {
      constraints.myPreferredSize.width = LwXmlReader.getRequiredInt(prefSizeElement, "width");
      constraints.myPreferredSize.height = LwXmlReader.getRequiredInt(prefSizeElement, "height");
    }

    // maximum size
    final Element maxSizeElement = LwXmlReader.getChild(gridElement, "maximum-size");
    if (maxSizeElement != null) {
      constraints.myMaximumSize.width = LwXmlReader.getRequiredInt(maxSizeElement, "width");
      constraints.myMaximumSize.height = LwXmlReader.getRequiredInt(maxSizeElement, "height");
    }

    component.getConstraints().restore(constraints);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:42,代碼來源:GridLayoutSerializer.java


注:本文中的com.intellij.uiDesigner.core.GridConstraints.setAnchor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。