当前位置: 首页>>代码示例>>Java>>正文


Java JBInsets.addTo方法代码示例

本文整理汇总了Java中com.intellij.util.ui.JBInsets.addTo方法的典型用法代码示例。如果您正苦于以下问题:Java JBInsets.addTo方法的具体用法?Java JBInsets.addTo怎么用?Java JBInsets.addTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.util.ui.JBInsets的用法示例。


在下文中一共展示了JBInsets.addTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: moveToFit

import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
public static void moveToFit(final Rectangle rectangle, final Rectangle container, @Nullable Insets padding) {
  Rectangle move = new Rectangle(rectangle);
  JBInsets.addTo(move, padding);

  if (move.getMaxX() > container.getMaxX()) {
    move.x = (int)container.getMaxX() - move.width;
  }


  if (move.getMinX() < container.getMinX()) {
    move.x = (int)container.getMinX();
  }

  if (move.getMaxY() > container.getMaxY()) {
    move.y = (int)container.getMaxY() - move.height;
  }

  if (move.getMinY() < container.getMinY()) {
    move.y = (int)container.getMinY();
  }

  JBInsets.removeFrom(move, padding);
  rectangle.setBounds(move);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ScreenUtil.java

示例2: validate

import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
@Override
public void validate() {
  super.validate();
  DialogWrapper wrapper = myDialogWrapper.get();
  if (wrapper != null && wrapper.isAutoAdjustable()) {
    Window window = wrapper.getWindow();
    if (window != null) {
      Dimension size = getMinimumSize();
      if (!(size == null ? myLastMinimumSize == null : size.equals(myLastMinimumSize))) {
        // update window minimum size only if root pane minimum size is changed
        if (size == null) {
          myLastMinimumSize = null;
        }
        else {
          myLastMinimumSize = new Dimension(size);
          JBInsets.addTo(size, window.getInsets());
        }
        window.setMinimumSize(size);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:DialogWrapperPeerImpl.java

示例3: getMinimumSize

import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
@Override
public Dimension getMinimumSize() {
  if (super.isMinimumSizeSet()) {
    return super.getMinimumSize();
  }

  Dimension size = new Dimension(1, 20);
  if (myEditor != null) {
    size.height = myEditor.getLineHeight();

    JBInsets.addTo(size, getInsets());
    JBInsets.addTo(size, myEditor.getInsets());
  }

  return size;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:EditorTextField.java

示例4: getPreferredSize

import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
private Dimension getPreferredSize(Container container, boolean aligned) {
  synchronized (container.getTreeLock()) {
    Dimension top = getPreferredSize(myTop);
    Dimension bottom = getPreferredSize(myBottom);
    Dimension center = getPreferredSize(myCenter);
    Dimension result = join(join(join(null, myGap + myGap, top), myGap + myGap, center), myGap + myGap, bottom);
    if (result == null) {
      result = new Dimension();
    }
    else if (aligned && center != null) {
      int topHeight = top == null ? 0 : top.height;
      int bottomHeight = bottom == null ? 0 : bottom.height;
      result.width += Math.abs(topHeight - bottomHeight);
    }
    JBInsets.addTo(result, container.getInsets());
    return result;
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:VerticalLayout.java

示例5: getMinimumSize

import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
@Override
public Dimension getMinimumSize() {
  if (isMinimumSizeSet()) {
    return super.getMinimumSize();
  }

  Dimension size = new Dimension(1, 20);
  if (myEditor != null) {
    size.height = myEditor.getLineHeight();

    JBInsets.addTo(size, getInsets());
    JBInsets.addTo(size, myEditor.getInsets());
  }

  return size;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:EditorTextField.java

示例6: paint

import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
@Override
public void paint(Graphics graphics) {
  Graphics2D g = (Graphics2D)graphics.create();
  try {
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
    myHelper.paint(g);
  }
  finally {
    g.dispose();
  }
  super.paint(graphics);

  if (UIUtil.isUnderGTKLookAndFeel()) {
    graphics.setColor(myTextArea.getBackground());
    Rectangle bounds = myScrollPane.getViewport().getBounds();
    if (myScrollPane.getVerticalScrollBar().isVisible()) {
      bounds.width -= myScrollPane.getVerticalScrollBar().getWidth();
    }
    bounds = SwingUtilities.convertRectangle(myScrollPane.getViewport()/*myTextArea*/, bounds, this);
    JBInsets.addTo(bounds, new JBInsets(2, 2, -1, -1));
    ((Graphics2D)graphics).draw(bounds);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:SearchTextArea.java

示例7: getPreferredSize

import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
@Override
public Dimension getPreferredSize() {
  Dimension size = super.getPreferredSize();
  Border border = super.getBorder();
  if (border != null && UIUtil.isUnderAquaLookAndFeel()) {
    JBInsets.addTo(size, border.getBorderInsets(this));
  }
  return size;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:SearchTextField.java

示例8: getPreferredSize

import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
@Override
public Dimension getPreferredSize() {
  final Dimension size = super.getPreferredSize();
  size.width += myMoreRec.width;
  JBInsets.addTo(size, myDownIconInsets);
  return size;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:JBOptionButton.java

示例9: getPreferredSize

import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
@Override
public Dimension getPreferredSize() {
  final ArrayList<Rectangle> bounds = new ArrayList<Rectangle>();
  calculateBounds(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE), bounds);
  if (bounds.isEmpty()) return JBUI.emptySize();
  int xLeft = Integer.MAX_VALUE;
  int yTop = Integer.MAX_VALUE;
  int xRight = Integer.MIN_VALUE;
  int yBottom = Integer.MIN_VALUE;
  for (int i = bounds.size() - 1; i >= 0; i--) {
    final Rectangle each = bounds.get(i);
    if (each.x == Integer.MAX_VALUE) continue;
    xLeft = Math.min(xLeft, each.x);
    yTop = Math.min(yTop, each.y);
    xRight = Math.max(xRight, each.x + each.width);
    yBottom = Math.max(yBottom, each.y + each.height);
  }
  final Dimension dimension = new Dimension(xRight - xLeft, yBottom - yTop);

  if (myLayoutPolicy == AUTO_LAYOUT_POLICY && myReservePlaceAutoPopupIcon) {
    if (myOrientation == SwingConstants.HORIZONTAL) {
      dimension.width += AllIcons.Ide.Link.getIconWidth();
    }
    else {
      dimension.height += AllIcons.Ide.Link.getIconHeight();
    }
  }

  JBInsets.addTo(dimension, getInsets());

  return dimension;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:ActionToolbarImpl.java

示例10: getPreferredSize

import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
@Override
public Dimension getPreferredSize() {
  if (super.isPreferredSizeSet()) {
    return super.getPreferredSize();
  }

  boolean toReleaseEditor = false;
  if (myEditor == null && myEnsureWillComputePreferredSize) {
    myEnsureWillComputePreferredSize = false;
    initEditor();
    toReleaseEditor = true;
  }


  Dimension size = new Dimension(100, 20);
  if (myEditor != null) {
    final Dimension preferredSize = new Dimension(myEditor.getComponent().getPreferredSize());

    if (myPreferredWidth != -1) {
      preferredSize.width = myPreferredWidth;
    }

    JBInsets.addTo(preferredSize, getInsets());
    size = preferredSize;
  } else if (myPassivePreferredSize != null) {
    size = myPassivePreferredSize;
  }

  if (toReleaseEditor) {
    releaseEditor();
    myPassivePreferredSize = size;
  }

  return size;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:EditorTextField.java

示例11: getPreferredSize

import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
@Override
public Dimension getPreferredSize() {
  if (UIUtil.isUnderIntelliJLaF() || UIUtil.isUnderDarcula()) {
    return super.getPreferredSize();
  }
  if (myEditorField != null) {
    final Dimension preferredSize = new Dimension(myEditorField.getComponent().getPreferredSize());
    JBInsets.addTo(preferredSize, getInsets());
    return preferredSize;
  }

  //final int cbHeight = new JComboBox().getPreferredSize().height; // should be used actually
  return new Dimension(100, UIUtil.fixComboBoxHeight(20));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:EditorComboBox.java

示例12: getPreferredSize

import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
@Override
public Dimension getPreferredSize() {
  if (isPreferredSizeSet()) {
    return super.getPreferredSize();
  }
  Dimension size = myTextField.getPreferredSize();
  JBInsets.addTo(size, getInsets());
  return size;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:ColorPanel.java

示例13: getPreferredFontSize

import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
private Dimension getPreferredFontSize() {
  Dimension size = new Dimension(myPrefWidth < 0 ? 0 : myPrefWidth, 1);
  String caption = getCaption();
  if (caption != null) {
    FontMetrics fm = getFontMetrics(getFont());
    size.height = fm.getHeight();
    if (myPrefWidth < 0) {
      size.width = 2 * getHgap() + fm.stringWidth(caption);
    }
  }
  JBInsets.addTo(size, getInsets());
  return size;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:14,代码来源:SeparatorWithText.java

示例14: validate

import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
@Override
public void validate() {
  super.validate();
  DialogWrapper wrapper = myDialogWrapper.get();
  if (wrapper != null && wrapper.isAutoAdjustable()) {
    Window window = wrapper.getWindow();
    if (window != null) {
      Dimension size = getMinimumSize();
      if (!(size == null ? myLastMinimumSize == null : size.equals(myLastMinimumSize))) {
        // update window minimum size only if root pane minimum size is changed
        if (size == null) {
          myLastMinimumSize = null;
        }
        else {
          myLastMinimumSize = new Dimension(size);
          JBInsets.addTo(size, window.getInsets());
          Rectangle screen = ScreenUtil.getScreenRectangle(window);
          if (size.width > screen.width || size.height > screen.height) {
            Application application = ApplicationManager.getApplication();
            if (application != null && application.isInternal()) {
              LOG.warn("minimum size " + size.width + "x" + size.height +
                       " is bigger than screen " + screen.width + "x" + screen.height);
            }
            if (size.width > screen.width) size.width = screen.width;
            if (size.height > screen.height) size.height = screen.height;
          }
        }
        window.setMinimumSize(size);
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:33,代码来源:DialogWrapperPeerImpl.java

示例15: getPreferredSize

import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
@Override
public Dimension getPreferredSize() {
  final ArrayList<Rectangle> bounds = new ArrayList<>();
  calculateBounds(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE), bounds);
  if (bounds.isEmpty()) return JBUI.emptySize();
  int xLeft = Integer.MAX_VALUE;
  int yTop = Integer.MAX_VALUE;
  int xRight = Integer.MIN_VALUE;
  int yBottom = Integer.MIN_VALUE;
  for (int i = bounds.size() - 1; i >= 0; i--) {
    final Rectangle each = bounds.get(i);
    if (each.x == Integer.MAX_VALUE) continue;
    xLeft = Math.min(xLeft, each.x);
    yTop = Math.min(yTop, each.y);
    xRight = Math.max(xRight, each.x + each.width);
    yBottom = Math.max(yBottom, each.y + each.height);
  }
  final Dimension dimension = new Dimension(xRight - xLeft, yBottom - yTop);

  if (myLayoutPolicy == AUTO_LAYOUT_POLICY && myReservePlaceAutoPopupIcon) {
    if (myOrientation == SwingConstants.HORIZONTAL) {
      dimension.width += AllIcons.Ide.Link.getIconWidth();
    }
    else {
      dimension.height += AllIcons.Ide.Link.getIconHeight();
    }
  }

  JBInsets.addTo(dimension, getInsets());

  return dimension;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:33,代码来源:ActionToolbarImpl.java


注:本文中的com.intellij.util.ui.JBInsets.addTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。