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


Java JBInsets类代码示例

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


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

示例1: getOptionsPanel

import com.intellij.util.ui.JBInsets; //导入依赖的package包/类
@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;
}
 
开发者ID:CeH9,项目名称:PackageTemplates,代码行数:25,代码来源:SelectFileTemplateDialog.java

示例2: paint

import com.intellij.util.ui.JBInsets; //导入依赖的package包/类
@Override
public void paint(final Graphics g) {
  Rectangle bounds = new Rectangle(getWidth(), getHeight());
  JBInsets.removeFrom(bounds, getInsets());

  bounds.x += (bounds.width - myIcon.getIconWidth()) / 2;
  bounds.y += (bounds.height - myIcon.getIconHeight()) / 2;

  if (myBehavior.isHovered()) {
    // todo
  }

  if (myBehavior.isPressedByMouse()) {
    bounds.x++;
    bounds.y++;
  }

  myIcon.paintIcon(this, g, bounds.x, bounds.y);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ConfigurationErrorsComponent.java

示例3: layout

import com.intellij.util.ui.JBInsets; //导入依赖的package包/类
private String layout(AbstractButton b, FontMetrics fm,
                      int width, int height) {
  viewRect.setBounds(0, 0, width, height);
  JBInsets.removeFrom(viewRect, b.getInsets());

  textRect.x = textRect.y = textRect.width = textRect.height = 0;
  iconRect.x = iconRect.y = iconRect.width = iconRect.height = 0;

  // layout the text and icon
  return SwingUtilities.layoutCompoundLabel(
    b, fm, b.getText(), b.getIcon(),
    b.getVerticalAlignment(), b.getHorizontalAlignment(),
    b.getVerticalTextPosition(), b.getHorizontalTextPosition(),
    viewRect, iconRect, textRect,
    b.getText() == null ? 0 : b.getIconTextGap());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:WizardArrowUI.java

示例4: 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

示例5: showFrame

import com.intellij.util.ui.JBInsets; //导入依赖的package包/类
public void showFrame() {
  final IdeFrameImpl frame = new IdeFrameImpl(ApplicationInfoEx.getInstanceEx(),
                                              myActionManager, myDataManager,
                                              ApplicationManager.getApplication());
  myProject2Frame.put(null, frame);

  if (myFrameBounds == null || !ScreenUtil.isVisible(myFrameBounds)) { //avoid situations when IdeFrame is out of all screens
    myFrameBounds = ScreenUtil.getMainScreenBounds();
    int xOff = myFrameBounds.width / 8;
    int yOff = myFrameBounds.height / 8;
    JBInsets.removeFrom(myFrameBounds, new Insets(yOff, xOff, yOff, xOff));
  }

  fixForOracleBug8007219(frame);

  frame.setBounds(myFrameBounds);
  frame.setExtendedState(myFrameExtendedState);
  frame.setVisible(true);

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:WindowManagerImpl.java

示例6: 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

示例7: paintComponent

import com.intellij.util.ui.JBInsets; //导入依赖的package包/类
public void paintComponent(Graphics g) {
  Icon icon = getIcon();
  FontMetrics fm = getFontMetrics(getFont());
  Rectangle viewRect = new Rectangle(getSize());
  JBInsets.removeFrom(viewRect, getInsets());

  Rectangle iconRect = new Rectangle();
  Rectangle textRect = new Rectangle();
  String text = SwingUtilities.layoutCompoundLabel(this, fm, getText(), icon,
                                                   SwingConstants.CENTER, horizontalTextAlignment(),
                                                   SwingConstants.CENTER, horizontalTextPosition(),
                                                   viewRect, iconRect, textRect, iconTextSpace());
  ActionButtonLook look = ActionButtonLook.IDEA_LOOK;
  look.paintBackground(g, this);
  look.paintIconAt(g, this, icon, iconRect.x, iconRect.y);
  look.paintBorder(g, this);

  UISettings.setupAntialiasing(g);
  g.setColor(isButtonEnabled() ? getForeground() : getInactiveTextColor());
  SwingUtilities2.drawStringUnderlineCharAt(this, g, text,
                                            getMnemonicCharIndex(text),
                                            textRect.x,
                                            textRect.y + fm.getAscent());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ActionButtonWithText.java

示例8: 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

示例9: doLayout

import com.intellij.util.ui.JBInsets; //导入依赖的package包/类
@Override
public void doLayout() {
  synchronized (getTreeLock()) {
    int count = getComponentCount();
    if (count == 1) {
      Rectangle bounds = new Rectangle(getWidth(), getHeight());
      JBInsets.removeFrom(bounds, getInsets());
      Component child = getComponent(0);
      child.setBounds(bounds);
      if (child instanceof CellRendererPanel) {
        ((CellRendererPanel)child).invalidateLayout();
        child.doLayout();
      }
    }
    else {
      invalidateLayout();
      super.doLayout();
      for (int i = 0; i < count; i++) {
        Component c = getComponent(i);
        if (c instanceof CellRendererPanel) {
          c.doLayout();
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:CellRendererPanel.java

示例10: calculateCheckBoxIndent

import com.intellij.util.ui.JBInsets; //导入依赖的package包/类
private static int calculateCheckBoxIndent() {
  JCheckBox checkBox = new JCheckBox();
  Icon icon = checkBox.getIcon();
  int indent = 0;
  if (icon == null) {
    icon = UIManager.getIcon("CheckBox.icon");
  }
  if (UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) {
    icon = EmptyIcon.create(20, 18);
  }
  if (icon != null) {
    final Rectangle r1 = new Rectangle(checkBox.getWidth(), checkBox.getHeight());
    JBInsets.removeFrom(r1, checkBox.getInsets());
    final Rectangle iconRect = new Rectangle();
    SwingUtilities.layoutCompoundLabel(
      checkBox, checkBox.getFontMetrics(checkBox.getFont()), checkBox.getText(), icon,
      checkBox.getVerticalAlignment(), checkBox.getHorizontalAlignment(),
      checkBox.getVerticalTextPosition(), checkBox.getHorizontalTextPosition(),
      r1, new Rectangle(), iconRect,
      checkBox.getText() == null ? 0 : checkBox.getIconTextGap());
    indent = iconRect.x;
  }
  return indent + checkBox.getIconTextGap();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:AdvancedSettingsAction.java

示例11: getComponent

import com.intellij.util.ui.JBInsets; //导入依赖的package包/类
@Override
public JComponent getComponent() {
  if (myWrapperPanel == null) {
    myWrapperPanel = new MTWrapperPanel(new BorderLayout()) {
      @Override
      public Insets getInsets() {
        return new JBInsets(0, 0, 0, 0);
      }

      @Override
      protected void paintComponent(final Graphics g) {
        super.paintComponent(g);
      }

    };
    myWrapperPanel.add(buildMTPanel(), BorderLayout.CENTER);
  }
  return myWrapperPanel;
}
 
开发者ID:ChrisRM,项目名称:material-theme-jetbrains,代码行数:20,代码来源:MTFrameComponentExtension.java

示例12: 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

示例13: 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

示例14: relayout

import com.intellij.util.ui.JBInsets; //导入依赖的package包/类
private void relayout() {
  final Dimension size = myLayeredPane.getSize();

  JBInsets.removeFrom(size, myInsets);

  final Rectangle layoutRec = new Rectangle(new Point(myInsets.left, myInsets.top), size);

  List<ArrayList<Balloon>> columns = createColumns(layoutRec);
  while (columns.size() > 1) {
    remove(myBalloons.get(0), true);
    columns = createColumns(layoutRec);
  }

  ToolWindowPanelImplEx pane = UIUtil.findComponentOfType2(myParent, ToolWindowPanelImplEx.class);
  JComponent layeredPane = pane != null ? pane.getMyLayeredPane() : null;
  int eachColumnX = (layeredPane == null ? myLayeredPane.getWidth() : layeredPane.getX() + layeredPane.getWidth()) - 4;

  newLayout(columns.get(0), eachColumnX + 4, (int)myLayeredPane.getBounds().getMaxY());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:DesktopBalloonLayoutImpl.java

示例15: doLayout

import com.intellij.util.ui.JBInsets; //导入依赖的package包/类
@Override
public void doLayout() {
  int count = getComponentCount();
  if (count == 1) {
    Rectangle bounds = new Rectangle(getWidth(), getHeight());
    JBInsets.removeFrom(bounds, getInsets());
    Component child = getComponent(0);
    child.setBounds(bounds);
    if (child instanceof CellRendererPanel) {
      ((CellRendererPanel)child).invalidateLayout();
      child.doLayout();
    }
  }
  else {
    invalidateLayout();
    super.doLayout();
    for (int i = 0; i < count; i++) {
      Component c = getComponent(i);
      if (c instanceof CellRendererPanel) {
        c.doLayout();
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:CellRendererPanel.java


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