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


Java GraphicsUtil.setupAntialiasing方法代码示例

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


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

示例1: paint

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
private void paint(Graphics2D g, int width) {
  GraphicsUtil.setupAntialiasing(g);


  if (!myApplied) {
    Shape upperCurve = makeCurve(width, myStart1, myStart2, true);
    Shape lowerCurve = makeCurve(width, myEnd1, myEnd2, false);

    Path2D path = new Path2D.Double();
    path.append(upperCurve, true);
    path.append(lowerCurve, true);
    g.setColor(myColor);
    g.fill(path);

    g.setColor(DiffUtil.getFramingColor(myColor));
    g.draw(upperCurve);
    g.draw(lowerCurve);
  }
  else {
    g.setColor(myColor);
    g.draw(makeCurve(width, myStart1 + 1, myStart2 + 1, true));
    g.draw(makeCurve(width, myStart1 + 2, myStart2 + 2, true));
    g.draw(makeCurve(width, myEnd1 + 1, myEnd2 + 1, false));
    g.draw(makeCurve(width, myEnd1 + 2, myEnd2 + 2, false));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:DividerPolygon.java

示例2: paintLabel

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
private void paintLabel(Graphics g, int cell, Rectangle cellBounds, @Nullable String label, int thumbnailHeight) {
  if (!StringUtil.isEmpty(label)) {
    final Color fg;
    if (hasFocus() && cell == mySelectedIndex && (getImage(cell) != null || UIUtil.isUnderDarcula())) {
      fg = UIUtil.getTreeSelectionForeground();
    }
    else {
      fg = UIUtil.getTreeForeground();
    }
    GraphicsUtil.setupAntialiasing(g);
    g.setColor(fg);
    FontMetrics fontMetrics = g.getFontMetrics();
    LineMetrics metrics = fontMetrics.getLineMetrics(label, g);
    int width = fontMetrics.stringWidth(label);

    int textBoxTop = myCellMargin.top + thumbnailHeight;
    int cellBottom = cellBounds.height - myCellMargin.bottom;

    int textY = cellBounds.y + (cellBottom + textBoxTop + (int)(metrics.getHeight() - metrics.getDescent())) / 2 ;
    int textX = (cellBounds.width - myCellMargin.left - myCellMargin.right - width) / 2 + cellBounds.x + myCellMargin.left;
    g.drawString(label, textX, textY);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ASGallery.java

示例3: paintIcon

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
public void paintIcon(final Component c, Graphics graphics) {
  if (myCounter <= 0)
    return;
  final Rectangle moreRect = getIconRec();

  if (moreRect == null) return;

  int iconY = getIconY(moreRect);
  int iconX = getIconX(moreRect);
  graphics.setFont(UIUtil.getLabelFont().deriveFont((float)Math.min(8, UIUtil.getButtonFont().getSize())));
  int width = graphics.getFontMetrics().stringWidth(String.valueOf(myCounter));
  iconX -= width / 2 + 1;

  AllIcons.General.MoreTabs.paintIcon(c, graphics, iconX, iconY);
  Graphics g = graphics.create();
  try {
    GraphicsUtil.setupAntialiasing(g, true, true);
    UIUtil.drawStringWithHighlighting(g, String.valueOf(myCounter),
                                      iconX + AllIcons.General.MoreTabs.getIconWidth() + 2,
                                      iconY + AllIcons.General.MoreTabs.getIconHeight() - 5,
                                      JBColor.BLACK,
                                      ColorUtil.withAlpha(JBColor.WHITE, .9));
  } finally {
    g.dispose();
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:MoreTabsIcon.java

示例4: paint

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
public void paint(Graphics g) {
  setBackground(UIUtil.getPanelBackground());
  super.paint(g);
  GraphicsUtil.setupAntialiasing(g);
  FontMetrics metrics = getFontMetrics(getFont());

  EditorColorsScheme colorScheme = myColorScheme != null
                                   ? myColorScheme
                                   : EditorColorsManager.getInstance().getGlobalScheme();
  g.setColor(myDiffType.getLegendColor(colorScheme));
  final int RECT_WIDTH = 35;
  g.fill3DRect(0, (getHeight() - 10) / 2, RECT_WIDTH, 10, true);

  Font font = g.getFont();
  if (font.getStyle() != Font.PLAIN) {
    font = font.deriveFont(Font.PLAIN);
  }
  g.setFont(font);
  g.setColor(UIUtil.getLabelForeground());
  int textBaseline = (getHeight() - metrics.getHeight()) / 2 + metrics.getAscent();
  g.drawString(myDiffType.getDisplayName(), RECT_WIDTH + UIUtil.DEFAULT_HGAP, textBaseline);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:DiffStatusBar.java

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

示例6: paint

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
@Override
public void paint(Graphics g) {
  GraphicsUtil.setupAntialiasing(g);
  super.paint(g);
  LayoutManager layout = getLayout();
  if (layout instanceof MyLayout) {
    ((MyLayout)layout).paintIfNeed(g);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JBPopupMenu.java

示例7: createRadioButtonMenuItem

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
private static JRadioButtonMenuItem createRadioButtonMenuItem(final String message) {
  return new JRadioButtonMenuItem(message) {
    @Override
    public void paint(Graphics g) {
      GraphicsUtil.setupAntialiasing(g);
      super.paint(g);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:DaemonEditorPopup.java

示例8: actionPerformed

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
@Override
public void actionPerformed(final AnActionEvent e) {
  final Editor editor = e.getData(CommonDataKeys.EDITOR_EVEN_IF_INACTIVE);
  if (editor == null) return;
  final String prefix = myTextField.getText().substring(0, myTextField.getCaretPosition());
  if (StringUtil.isEmpty(prefix)) return;

    final String[] array = calcWords(prefix, editor);
    if (array.length == 0) {
      return;
    }

    FeatureUsageTracker.getInstance().triggerFeatureUsed("find.completion");
    final JList list = new JBList(array) {
      @Override
      protected void paintComponent(final Graphics g) {
        GraphicsUtil.setupAntialiasing(g);
        super.paintComponent(g);
      }
    };
    list.setBackground(new JBColor(new Color(235, 244, 254), new Color(0x4C4F51)));
    list.setFont(editor.getColorsScheme().getFont(EditorFontType.PLAIN));

    Utils.showCompletionPopup(
      e.getInputEvent() instanceof MouseEvent ? myTextField: null,
      list, null, myTextField, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:VariantsCompletionAction.java

示例9: paintComponent

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
protected void paintComponent(final Graphics g) {
  if (myCompact) {
    super.paintComponent(g);
    return;
  }

  final GraphicsConfig c = GraphicsUtil.setupAAPainting(g);
  GraphicsUtil.setupAntialiasing(g, true, true);

  int arc = 8;
  Color bg = getBackground();
  final Rectangle bounds = myProcessName.getBounds();
  final Rectangle label = SwingUtilities.convertRectangle(myProcessName.getParent(), bounds, this);

  g.setColor(UIUtil.getPanelBackground());
  g.fillRoundRect(0, 0, getWidth() - 1, getHeight() - 1, arc, arc);

  if (!UIUtil.isUnderDarcula()) {
    bg = ColorUtil.toAlpha(bg.darker().darker(), 230);
    g.setColor(bg);

    g.fillRoundRect(0, 0, getWidth() - 1, getHeight() - 1, arc, arc);

    g.setColor(UIUtil.getPanelBackground());
    g.fillRoundRect(0, getHeight() / 2, getWidth() - 1, getHeight() / 2, arc, arc);
    g.fillRect(0, (int)label.getMaxY() + 1, getWidth() - 1, getHeight() / 2);
  } else {
    bg = bg.brighter();
    g.setColor(bg);
    g.drawLine(0, (int)label.getMaxY() + 1, getWidth() - 1, (int)label.getMaxY() + 1);
  }

  g.setColor(bg);
  g.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, arc, arc);

  c.restore();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:38,代码来源:InlineProgressIndicator.java

示例10: actionPerformed

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
@Override
public void actionPerformed(final AnActionEvent e) {
  final String prefix = getPrefix();
  if (StringUtil.isEmpty(prefix)) return;

  Editor editor = getEditorSearchComponent().getEditor();
  if (editor != null) {
    final String[] array = calcWords(prefix, editor);
    if (array.length == 0) {
      return;
    }

    FeatureUsageTracker.getInstance().triggerFeatureUsed("find.completion");
    final JList list = new JBList(array) {
      @Override
      protected void paintComponent(final Graphics g) {
        GraphicsUtil.setupAntialiasing(g);
        super.paintComponent(g);
      }
    };
    list.setBackground(EditorSearchComponent.COMPLETION_BACKGROUND_COLOR);
    list.setFont(editor.getColorsScheme().getFont(EditorFontType.PLAIN));

    Utils.showCompletionPopup(
      e.getInputEvent() instanceof MouseEvent ? getEditorSearchComponent().getToolbarComponent() : null,
      list, null, getTextField(), null);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:VariantsCompletionAction.java

示例11: paintIcon

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
  GraphicsUtil.setupAntialiasing(g, true, false);
  if (myTextHeight <= 0) {
    myTextHeight = g.getFont().createGlyphVector(((Graphics2D)g).getFontRenderContext(), myText).getPixelBounds(null, 0, 0).height;
  }

  g.setColor(UIUtil.getLabelForeground());
  g.drawString(myText, x + 2, y + myControlHeight - ((myControlHeight - myTextHeight) / 2));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:TextIcon.java

示例12: actionPerformed

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
@RequiredDispatchThread
@Override
public void actionPerformed(@Nonnull final AnActionEvent e) {
  final Editor editor = e.getData(CommonDataKeys.EDITOR_EVEN_IF_INACTIVE);
  if (editor == null) return;
  final String prefix = myTextField.getText().substring(0, myTextField.getCaretPosition());
  if (StringUtil.isEmpty(prefix)) return;

  final String[] array = calcWords(prefix, editor);
  if (array.length == 0) {
    return;
  }

  FeatureUsageTracker.getInstance().triggerFeatureUsed("find.completion");
  final JList list = new JBList(array) {
    @Override
    protected void paintComponent(final Graphics g) {
      GraphicsUtil.setupAntialiasing(g);
      super.paintComponent(g);
    }
  };
  list.setBackground(new JBColor(new Color(235, 244, 254), new Color(0x4C4F51)));
  list.setFont(editor.getColorsScheme().getFont(EditorFontType.PLAIN));

  Utils.showCompletionPopup(
          e.getInputEvent() instanceof MouseEvent ? myTextField: null,
          list, null, myTextField, null);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:29,代码来源:VariantsCompletionAction.java

示例13: paint

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
@Override
public void paint(Graphics g) {
  GraphicsUtil.setupAntialiasing(g);
  super.paint(g);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:JBMenuItem.java

示例14: paint

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
@Override
public void paint(Graphics g, JComponent c) {
  GraphicsUtil.setupAntialiasing(g);
  super.paint(g, c);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:IdeaHelpContentViewUI.java

示例15: paintIcon

import com.intellij.util.ui.GraphicsUtil; //导入方法依赖的package包/类
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
  GraphicsUtil.setupAntialiasing(g);
  g.setColor(myType.getLegendColor(myColorScheme != null ? myColorScheme : EditorColorsManager.getInstance().getGlobalScheme()));
  g.fill3DRect(x, y, getIconWidth(), getIconHeight(), true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:DiffStatusBar.java


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