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


Java JBUI.scale方法代码示例

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


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

示例1: getSmallApplicationIcon

import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
protected static Icon getSmallApplicationIcon() {
  if (ourSmallAppIcon == null) {
    try {
      Icon appIcon = IconLoader.findIcon(ApplicationInfoEx.getInstanceEx().getIconUrl());

      if (appIcon != null) {
        if (appIcon.getIconWidth() == JBUI.scale(16) && appIcon.getIconHeight() == JBUI.scale(16)) {
          ourSmallAppIcon = appIcon;
        } else {
          BufferedImage image = ImageUtil.toBufferedImage(IconUtil.toImage(appIcon));
          image = Scalr.resize(image, Scalr.Method.ULTRA_QUALITY, UIUtil.isRetina() ? 32 : JBUI.scale(16));
          ourSmallAppIcon = toRetinaAwareIcon(image);
        }
      }
    }
    catch (Exception e) {//
    }
    if (ourSmallAppIcon == null) {
      ourSmallAppIcon = EmptyIcon.ICON_16;
    }
  }

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

示例2: paintCheckSign

import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
protected void paintCheckSign(Graphics2D g, boolean enabled, int w, int h) {
  g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
  g.setStroke(new BasicStroke(1 * JBUI.scale(2.0f), BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
  g.setPaint(getShadowColor(enabled, true));
  final int x1 = JBUI.scale(4);
  final int y1 = JBUI.scale(7);
  final int x2 = JBUI.scale(7);
  final int y2 = JBUI.scale(11);
  final int x3 = w;
  final int y3 = JBUI.scale(2);

  g.drawLine(x1, y1, x2, y2);
  g.drawLine(x2, y2, x3, y3);
  g.setPaint(getCheckSignColor(enabled, true));
  g.translate(0, -2);
  g.drawLine(x1, y1, x2, y2);
  g.drawLine(x2, y2, x3, y3);
  g.translate(0, 2);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:DarculaCheckBoxUI.java

示例3: getPreferredSize

import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
@Override
public Dimension getPreferredSize() {
  final Dimension preferredSize = super.getPreferredSize();
  final int width = JBUI.scale(300);
  if (preferredSize.width < width){
    preferredSize.width = width;
  }
  return preferredSize;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:10,代码来源:StudyStepicUserWidget.java

示例4: setContentBody

import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
public void setContentBody(String text) {
    JLabel label = new JLabel();
    Font font = label.getFont();
    Color textColor = label.getForeground();
    String out = "<html><head></head><body><div style='font-family:" + font.getFontName() + ";" + "font-size:" + JBUI.scale(font.getSize()) + "pt; color:" + Utils.toRgbString(textColor) + "'>" +
            (text == null ? "" : text) +
            "</div></body></html>";
    myTextContent = out;
    myTextPane.setText(out);
    myPanel.validate();
}
 
开发者ID:vsch,项目名称:MissingInActions,代码行数:12,代码来源:MultiPasteOptionsPane.java

示例5: getPreferredSize

import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
@Override
public Dimension getPreferredSize() {
    final boolean isEmpty = getIcon() == null && StringUtil.isEmpty(getText());
    int width = isEmpty ? JBUI.scale(10) + getArrowIcon().getIconWidth() : super.getPreferredSize().width;
    if (isSmallVariant() && !((SystemInfo.isMac && UIUtil.isUnderIntelliJLaF()))) {
        width += JBUI.scale(4);
        if (UIUtil.isUnderWin10LookAndFeel()) {
            width += JBUI.scale(8);
        }
    }
    return new Dimension(width, isSmallVariant() ? JBUI.scale(19) : super.getPreferredSize().height);
}
 
开发者ID:vsch,项目名称:MissingInActions,代码行数:13,代码来源:ComboBoxAction.java

示例6: getPreferredSize

import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
@Override
public Dimension getPreferredSize() {
    final Insets insets = getInsets();
    int width = getFontMetrics(getWidgetFont()).stringWidth(SAMPLE_STRING) + insets.left + insets.right + JBUI.scale(2);
    int height = getFontMetrics(getWidgetFont()).getHeight() + insets.top + insets.bottom + JBUI.scale(2);
    return new Dimension(width, height);
}
 
开发者ID:Darkyenus,项目名称:DarkyenusTimeTracker,代码行数:8,代码来源:TimeTrackerWidget.java

示例7: paintBorder

import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
  final Graphics2D g2d = (Graphics2D)g;
  final Insets ins = getBorderInsets(c);
  final int yOff = (ins.top + ins.bottom) / 4;
  final boolean square = DarculaButtonUI.isSquare(c);
  int offset = JBUI.scale(square ? 1 : getOffset());
  int w = c.getWidth();
  int h = c.getHeight();
  int diam = JBUI.scale(22);

  if (c.hasFocus()) {
    if (DarculaButtonUI.isHelpButton((JComponent)c)) {
        DarculaUIUtil.paintFocusOval(g2d, (w - diam) / 2, (h - diam) / 2, diam, diam);
    } else {
      DarculaUIUtil.paintFocusRing(g2d, offset, yOff, width - 2 * offset, height - 2 * yOff);
    }
  } else {
    final GraphicsConfig config = new GraphicsConfig(g);
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_DEFAULT);
    g2d.setPaint(UIUtil.getGradientPaint(width / 2, y + yOff + JBUI.scale(1), Gray._80.withAlpha(90), width / 2, height - 2 * yOff, Gray._90.withAlpha(90)));
    //g.drawRoundRect(x + offset + 1, y + yOff + 1, width - 2 * offset, height - 2*yOff, 5, 5);
    ((Graphics2D)g).setPaint(Gray._100.withAlpha(180));
    if (DarculaButtonUI.isHelpButton((JComponent)c)) {
      g.drawOval((w - diam) / 2, (h - diam) / 2, diam, diam);
    } else {
      g.translate(x,y);
      int r = JBUI.scale(square ? 3 : 5);
      g.drawRoundRect(offset, yOff, width - 2 * offset, height - 2 * yOff, r, r);
      g.translate(-x,-y);
    }

    config.restore();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:DarculaButtonPainter.java

示例8: isInDragZone

import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
boolean isInDragZone(MouseEvent e) {
  MouseEvent event = getTargetEvent(e);
  Point p = event.getPoint();
  boolean vertical = isVertical();
  OnePixelDivider d = OnePixelDivider.this;
  if ((vertical ? p.x : p.y) < 0 || vertical && p.x > d.getWidth() || !vertical && p.y > d.getHeight()) return false;
  int r = Math.abs(vertical ? p.y : p.x);
  return r < JBUI.scale(6);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:OnePixelDivider.java

示例9: getPreferredSize

import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
@Override
public Dimension getPreferredSize() {
  final boolean isEmpty = getIcon() == null && StringUtil.isEmpty(getText());
  int width = isEmpty ? JBUI.scale(10) + ARROW_ICON.getIconWidth() : super.getPreferredSize().width;
  if (isSmallVariant() && !(SystemInfo.isMac && UIUtil.isUnderIntelliJLaF())) width += JBUI.scale(4);
  return new Dimension(width, isSmallVariant() ? JBUI.scale(19) : super.getPreferredSize().height);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ComboBoxAction.java

示例10: getDrawingRect

import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
protected Rectangle getDrawingRect() {
  final JTextComponent c = myTextField;
  final JBInsets i = JBInsets.create(c.getInsets());
  final int x = i.right - JBUI.scale(4) - JBUI.scale(16);
  final int y = i.top - 3;
  final int w = c.getWidth() - i.width() + JBUI.scale(16*2 +7*2  - 5);
  int h = c.getBounds().height - i.height() + JBUI.scale(4*2 - 3);
  if (h%2==1) h++;
  return new Rectangle(x, y, w, h);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:DarculaTextFieldUI.java

示例11: drawDirectedBox

import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
private void drawDirectedBox(Graphics2D g,
                             int anchorX,
                             int y,
                             int width,
                             int height,
                             int baseHeight,
                             boolean active) {
  Object antialiasing = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
  if (SystemInfo.isMac && SystemInfo.JAVA_VERSION.startsWith("1.4.1") || UIUtil.isRetina()) {
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  }

  try {
    final int off = JBUI.scale(2);
    int[] xPoints = {anchorX, anchorX + width, anchorX + width, anchorX + width / 2, anchorX};
    int[] yPoints = {y, y, y + baseHeight, y + height, y + baseHeight};

    g.setColor(myEditor.getBackgroundColor());
    g.fillPolygon(xPoints, yPoints, 5);

    g.setColor(getOutlineColor(active));
    g.drawPolygon(xPoints, yPoints, 5);

    //Minus
    int minusHeight = y + baseHeight / 2 + (height - baseHeight) / 4;
    UIUtil.drawLine(g, anchorX + off, minusHeight, anchorX + width - off, minusHeight);
  }
  finally {
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, antialiasing);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:EditorGutterComponentImpl.java

示例12: IdeaMenuUI

import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
public IdeaMenuUI() {
  myMaxGutterIconWidth = JBUI.scale(18);

  if (UIUtil.isUnderAquaLookAndFeel() || UIUtil.isUnderIntelliJLaF()) {
    if (myAquaSelectedBackgroundPainter == null) myAquaSelectedBackgroundPainter = (Border) UIManager.get("MenuItem.selectedBackgroundPainter");
    if (myAquaInvertedArrowIcon == null) myAquaInvertedArrowIcon = (Icon) UIManager.get("Menu.invertedArrowIcon");
    if (myAquaDisabledArrowIcon == null) myAquaDisabledArrowIcon = (Icon) UIManager.get("Menu.disabledArrowIcon");
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:IdeaMenuUI.java

示例13: paint

import com.intellij.util.ui.JBUI; //导入方法依赖的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_NORMALIZE);
    Rectangle r = new Rectangle(getSize());
    r.x += JBUI.scale(4);
    r.y += JBUI.scale(3);
    r.width -= JBUI.scale(9);
    r.height -= JBUI.scale(6);
    int arcSize = Math.min(25, r.height - 1) - 6;
    g.setColor(myTextArea.getBackground());
    boolean hasFocus = myTextArea.hasFocus();
    g.fillRoundRect(r.x, r.y + 1, r.width, r.height - 2, arcSize, arcSize);
    g.setColor(myTextArea.isEnabled() ? Gray._100 : Gray._83);

    if (hasFocus) {
      DarculaUIUtil.paintSearchFocusRing(g, r, arcSize + 6);
    }
    else {
      g.drawRoundRect(r.x, r.y, r.width, r.height - 1, arcSize, arcSize);
    }
  }
  finally {
    g.dispose();
  }
  super.paint(graphics);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:SearchTextArea.java

示例14: BorderLayoutPanel

import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
public BorderLayoutPanel(int hgap, int vgap) {
  super(new BorderLayout(JBUI.scale(hgap), JBUI.scale(vgap)));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:BorderLayoutPanel.java

示例15: getSearchIconCoord

import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
protected Point getSearchIconCoord() {
  final Rectangle r = getDrawingRect();
  return new Point(r.x + JBUI.scale(3), r.y + (r.height - JBUI.scale(16)) / 2 + JBUI.scale(1));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:DarculaTextFieldUI.java


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