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


Java GraphicsUtil.setupAAPainting方法代码示例

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


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

示例1: paintComponent

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
@Override
protected void paintComponent(Graphics g) {
  Color bg = getBackground();
  if (bg == null) {
    bg = UIUtil.getPanelBackground();
  }
  g.setColor(bg);
  if (isOpaque()) {
    g.fillRect(0,0, getWidth() - 1, getHeight()-1);
  }
  final Border border = getBorder();
  final Insets insets = border == null ? new Insets(0,0,0,0) : border.getBorderInsets(this);
  int x = (getWidth() - insets.left - insets.right - myIcon.getIconWidth()) / 2;
  int y = insets.top;
  myIcon.paintIcon(this, g, x, y);
  g.setFont(getFont());
  y += myIcon.getIconHeight();
  final FontMetrics metrics = getFontMetrics(getFont());
  x = (getWidth() - insets.left - insets.right - metrics.stringWidth(myLabel)) / 2;
  y += 1.5 * metrics.getHeight();
  g.setColor(UIUtil.getLabelForeground());
  GraphicsUtil.setupAAPainting(g);
  g.drawString(myLabel, x, y);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:PreferenceButton.java

示例2: paintIcon

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
public void paintIcon(Component c, Graphics g, int x, int y) {
  final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);

  ((Graphics2D)g).setPaint(myBgrnd);

  myForm.draw(c, (Graphics2D)g, myWidth, myHeight, x, y, myWithContinuation, myEmphasize);

  g.setFont(myFont);
  g.setColor(UIUtil.getTextAreaForeground());
  g.drawString(myText, x + 4, y + myHeight - 3);  // -2

  g.setColor(myBgrnd.darker().darker());
  g.setFont(myPlusFont);
  if (myWithContinuation) {
    g.drawString(" +", x + myWidth - 2 - myAddWidth, y + myHeight - 3);
  }

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

示例3: createUIComponents

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
private void createUIComponents() {
  myButton = new JPanel(new BorderLayout()) {
    {
      enableEvents(AWTEvent.MOUSE_EVENT_MASK);
    }

    @Override
    protected void paintComponent(Graphics g) {
      super.paintComponent(g);
      GraphicsUtil.setupAAPainting(g);
      ((Graphics2D)g).setPaint(new GradientPaint(0, 0, BODY_COLOR_1, 0, getHeight(), BODY_COLOR_2));
      g.fillRoundRect(0, 0, getWidth() - 1, getHeight() - 1, 5, 5);
      ((Graphics2D)g).setStroke(new BasicStroke(UIUtil.isUnderDarcula() ? 2f : 1f));
      g.setColor(BORDER_COLOR);
      g.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, 5, 5);
    }
  };

  myMessage = IdeTooltipManager.initPane("", new HintHint().setAwtTooltip(true), null);
  myMessage.setFont(UIUtil.getLabelFont().deriveFont(UIUtil.getLabelFont().getSize() + 2f));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GotItPanel.java

示例4: paintRowData

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
private static void paintRowData(Tree tree, String duration, Rectangle bounds, Graphics2D g, boolean isSelected, boolean hasFocus) {
  final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
  g.setFont(tree.getFont().deriveFont(Font.PLAIN, UIUtil.getFontSize(UIUtil.FontSize.SMALL)));
  final FontMetrics metrics = tree.getFontMetrics(g.getFont());
  int totalWidth = metrics.stringWidth(duration) + 2;
  int x = bounds.x + bounds.width - totalWidth;
  g.setColor(isSelected ? UIUtil.getTreeSelectionBackground(hasFocus) : UIUtil.getTreeBackground());
  final int leftOffset = 5;
  g.fillRect(x - leftOffset, bounds.y, totalWidth + leftOffset, bounds.height);
  g.translate(0, bounds.y - 1);
  if (isSelected) {
    if (!hasFocus && UIUtil.isUnderAquaBasedLookAndFeel()) {
      g.setColor(UIUtil.getTreeForeground());
    }
    else {
      g.setColor(UIUtil.getTreeSelectionForeground());
    }
  }
  else {
    g.setColor(new JBColor(0x808080, 0x808080));
  }
  g.drawString(duration, x, SimpleColoredComponent.getTextBaseLine(tree.getFontMetrics(tree.getFont()), bounds.height) + 1);
  g.translate(0, -bounds.y + 1);
  config.restore();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:TestTreeView.java

示例5: paintBorder

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
public void paintBorder(Graphics g, JComponent component, int state) {
  if (state == ActionButtonComponent.NORMAL) return;
  Rectangle r = new Rectangle(component.getWidth(), component.getHeight());

  if (UIUtil.isUnderAquaLookAndFeel()) {
    if (state == ActionButtonComponent.POPPED) {
      g.setColor(ALPHA_30);
      g.drawRoundRect(r.x, r.y, r.width - 2, r.height - 2, 4, 4);
    }
  }
  else {
    final double shift = UIUtil.isUnderDarcula() ? 1/0.49 : 0.49;
    g.setColor(ColorUtil.shift(UIUtil.getPanelBackground(), shift));
    ((Graphics2D)g).setStroke(BASIC_STROKE);
    final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
    g.drawRoundRect(r.x, r.y, r.width - 2, r.height - 2, 4, 4);
    config.restore();
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:IdeaActionButtonLook.java

示例6: paint

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
public void paint(@Nonnull Graphics2D g2, int x, int y, int height) {
  if (myLabels.isEmpty()) return;

  GraphicsConfig config = GraphicsUtil.setupAAPainting(g2);
  g2.setFont(getReferenceFont());
  g2.setStroke(new BasicStroke(1.5f));

  FontMetrics fontMetrics = g2.getFontMetrics();

  x += PaintParameters.LABEL_PADDING;
  for (Pair<String, Color> label : myLabels) {
    Dimension size = myLabelPainter.calculateSize(label.first, fontMetrics);
    int paddingY = y + (height - size.height) / 2;
    myLabelPainter.paint(g2, label.first, x, paddingY, getLabelColor(label.second));
    x += size.width + PaintParameters.LABEL_PADDING;
  }

  config.restore();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:RectangleReferencePainter.java

示例7: paint

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
public void paint(@Nonnull Graphics2D g2, @Nonnull String text, int paddingX, int paddingY, @Nonnull Color color) {
  GraphicsConfig config = GraphicsUtil.setupAAPainting(g2);
  g2.setFont(getLabelFont());
  g2.setStroke(new BasicStroke(1.5f));

  FontMetrics fontMetrics = g2.getFontMetrics();
  int width = fontMetrics.stringWidth(text) + 2 * TEXT_PADDING_X;
  int height = fontMetrics.getHeight() + TOP_TEXT_PADDING + BOTTOM_TEXT_PADDING;

  g2.setColor(color);
  if (mySquare) {
    g2.fillRect(paddingX, paddingY, width, height);
  }
  else {
    g2.fill(new RoundRectangle2D.Double(paddingX, paddingY, width, height, LABEL_ARC, LABEL_ARC));
  }

  g2.setColor(JBColor.BLACK);
  int x = paddingX + TEXT_PADDING_X;
  int y = paddingY + SimpleColoredComponent.getTextBaseLine(fontMetrics, height);
  g2.drawString(text, x, y);

  config.restore();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:RectanglePainter.java

示例8: paintIcon

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
private void paintIcon(@Nonnull Graphics2D g2) {
  GraphicsConfig config = GraphicsUtil.setupAAPainting(g2);

  float scale = mySize / 8.0f;

  for (int i = myColors.length - 1; i >= 0; i--) {
    if (i != myColors.length - 1) {
      g2.setColor(myBgColor);
      paintTag(g2, scale, scale * 2 * i + 1, 0);
    }
    g2.setColor(myColors[i]);
    paintTag(g2, scale, scale * 2 * i, 0);
  }

  config.restore();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:LabelIcon.java

示例9: paintBorder

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
protected void paintBorder(ActionButton button, Graphics g, Dimension size, int state) {
  if (UIUtil.isUnderAquaLookAndFeel()) {
    if (state == ActionButtonComponent.POPPED) {
      g.setColor(ALPHA_30);
      g.drawRoundRect(0, 0, size.width - 2, size.height - 2, 4, 4);
    }
  }
  else {
    final double shift = UIUtil.isUnderDarcula() ? 1 / 0.49 : 0.49;
    g.setColor(ColorUtil.shift(UIUtil.getPanelBackground(), shift));
    ((Graphics2D)g).setStroke(BASIC_STROKE);
    final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
    g.drawRoundRect(0, 0, size.width - JBUI.scale(2), size.height - JBUI.scale(2), JBUI.scale(4), JBUI.scale(4));
    config.restore();
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:ActionButtonUI.java

示例10: paintBorder

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
private static void paintBorder(Graphics g, Dimension size, int state) {
  if (UIUtil.isUnderAquaLookAndFeel()) {
    if (state == ActionButtonComponent.POPPED) {
      g.setColor(ALPHA_30);
      g.drawRoundRect(0, 0, size.width - 2, size.height - 2, 4, 4);
    }
  }
  else {
    final double shift = UIUtil.isUnderDarcula() ? 1 / 0.49 : 0.49;
    g.setColor(ColorUtil.shift(UIUtil.getPanelBackground(), shift));
    ((Graphics2D)g).setStroke(BASIC_STROKE);
    final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
    g.drawRoundRect(0, 0, size.width - JBUI.scale(2), size.height - JBUI.scale(2), JBUI.scale(4), JBUI.scale(4));
    config.restore();
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:PoppedIcon.java

示例11: paint

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
@Override
public void paint(Graphics g, JComponent c) {
  int w = c.getWidth();
  int h = c.getHeight();
  layout(myButton, SwingUtilities2.getFontMetrics(c, g), w, h);

  final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
  h-=4;
  if (!myButton.isSelected()) {
    w-=15;
  }
  final Path2D.Double path = new GeneralPath.Double();
  path.moveTo(0, 0);
  path.lineTo(w - h / 2, 0);
  path.lineTo(w, h / 2);
  path.lineTo(w-h/2, h);
  path.lineTo(0, h);
  path.lineTo(0, 0);
  g.setColor(myButton.isSelected() ? UIUtil.getListSelectionBackground() : Gray._255.withAlpha(200));
  ((Graphics2D)g).fill(path);
  g.setColor(Gray._0.withAlpha(50));
  ((Graphics2D)g).draw(path);
  config.restore();
  textRect.x = 2;
  textRect.y-=7;
  c.setForeground(UIUtil.getListForeground(myButton.isSelected()));
  GraphicsUtil.setupAntialiasing(g);
  paintText(g, c, textRect, myButton.getText());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:WizardArrowUI.java

示例12: paintSeparators

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
public static void paintSeparators(@NotNull Graphics2D gg,
                                   int width,
                                   @NotNull Editor editor1,
                                   @NotNull Editor editor2,
                                   @NotNull DividerSeparatorPaintable paintable) {
  List<DividerSeparator> polygons = createVisibleSeparators(editor1, editor2, paintable);

  GraphicsConfig config = GraphicsUtil.setupAAPainting(gg);
  for (DividerSeparator polygon : polygons) {
    polygon.paint(gg, width);
  }
  config.restore();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:DiffDividerDrawUtil.java

示例13: paintSeparatorsOnScrollbar

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
public static void paintSeparatorsOnScrollbar(@NotNull Graphics2D gg,
                                              int width,
                                              @NotNull Editor editor1,
                                              @NotNull Editor editor2,
                                              @NotNull DividerSeparatorPaintable paintable) {
  List<DividerSeparator> polygons = createVisibleSeparators(editor1, editor2, paintable);

  GraphicsConfig config = GraphicsUtil.setupAAPainting(gg);
  for (DividerSeparator polygon : polygons) {
    polygon.paintOnScrollbar(gg, width);
  }
  config.restore();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:DiffDividerDrawUtil.java

示例14: paintPolygons

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
public static void paintPolygons(@NotNull Graphics2D gg,
                                 int width,
                                 boolean paintBorder,
                                 boolean curved,
                                 @NotNull Editor editor1,
                                 @NotNull Editor editor2,
                                 @NotNull DividerPaintable paintable) {
  List<DividerPolygon> polygons = createVisiblePolygons(editor1, editor2, paintable);

  GraphicsConfig config = GraphicsUtil.setupAAPainting(gg);
  for (DividerPolygon polygon : polygons) {
    polygon.paint(gg, width, paintBorder, curved);
  }
  config.restore();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:DiffDividerDrawUtil.java

示例15: paintComponent

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
@Override
public void paintComponent(Graphics g) {
  super.paintComponent(g);

  AnAction action = getAction();
  if (action instanceof ActivateCard) {
    Rectangle bounds = getBounds();

    Icon icon = AllIcons.Actions.Forward; //AllIcons.Icons.Ide.NextStepGrayed;
    int y = (bounds.height - icon.getIconHeight()) / 2;
    int x = bounds.width - icon.getIconWidth() - 15;

    if (getPopState() == POPPED) {
      final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
      g.setColor(WelcomeScreenColors.CAPTION_BACKGROUND);
      g.fillOval(x - 3, y - 3, icon.getIconWidth() + 6, icon.getIconHeight() + 6);

      g.setColor(WelcomeScreenColors.GROUP_ICON_BORDER_COLOR);
      g.drawOval(x - 3, y - 3, icon.getIconWidth() + 6, icon.getIconHeight() + 6);
      config.restore();
    }
    else {
      icon = IconLoader.getDisabledIcon(icon);
    }

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


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