• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java GraphicsConfig类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: paintFileColorGutter

import com.intellij.openapi.ui.GraphicsConfig; //导入依赖的package包/类
protected void paintFileColorGutter(final Graphics g) {
  final GraphicsConfig config = new GraphicsConfig(g);
  final Rectangle rect = getVisibleRect();
  final int firstVisibleRow = getClosestRowForLocation(rect.x, rect.y);
  final int lastVisibleRow = getClosestRowForLocation(rect.x, rect.y + rect.height);

  for (int row = firstVisibleRow; row <= lastVisibleRow; row++) {
    final TreePath path = getPathForRow(row);
    if (path != null) {
      final Rectangle bounds = getRowBounds(row);
      Object component = path.getLastPathComponent();
      final Object[] pathObjects = path.getPath();
      if (component instanceof LoadingNode && pathObjects.length > 1) {
        component = pathObjects[pathObjects.length - 2];
      }

      Color color = getFileColorFor((DefaultMutableTreeNode)component);
      if (color != null) {
        g.setColor(color);
        g.fillRect(0, bounds.y, getWidth(), bounds.height);
      }
    }
  }
  config.restore();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:Tree.java


示例2: paintIcon

import com.intellij.openapi.ui.GraphicsConfig; //导入依赖的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: paintBorder

import com.intellij.openapi.ui.GraphicsConfig; //导入依赖的package包/类
protected void paintBorder(Graphics g, Dimension size, int state) {
  GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
  try {
    if (UIUtil.isUnderAquaLookAndFeel()) {
      if (state == ActionButtonComponent.POPPED) {
        g.setColor(JBColor.GRAY);
        ((Graphics2D)g).draw(getShape(size));
      }
    }
    else if (SystemInfo.isMac && UIUtil.isUnderIntelliJLaF()) {
      //do nothing
    }
    else {
      final double shift = UIUtil.isUnderDarcula() ? 1 / 0.49 : 0.49;
      g.setColor(ColorUtil.shift(UIUtil.getPanelBackground(), shift));
      ((Graphics2D)g).setStroke(BASIC_STROKE);
      ((Graphics2D)g).draw(getShape(size));
    }
  }
  finally {
    config.restore();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:IdeaActionButtonLook.java


示例4: paintBackground

import com.intellij.openapi.ui.GraphicsConfig; //导入依赖的package包/类
@Override
protected void paintBackground(Graphics graphics) {
  Graphics2D g = (Graphics2D)graphics;
  final JTextComponent c = getComponent();
  final Container parent = c.getParent();
  final Rectangle r = getDrawingRect();
  if (c.isOpaque() && parent != null) {
    g.setColor(parent.getBackground());
    g.fillRect(0, 0, c.getWidth(), c.getHeight());
  }
  final GraphicsConfig config = new GraphicsConfig(g);
  g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);

  final Border border = c.getBorder();
  if (isSearchField(c)) {
    paintSearchField(g, c, r);
  } else if (border instanceof DarculaTextBorder) {
    paintDarculaBackground(g, c, border);
  } else {
    super.paintBackground(g);
  }
  config.restore();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:DarculaTextFieldUI.java


示例5: paintBorder

import com.intellij.openapi.ui.GraphicsConfig; //导入依赖的package包/类
@Override
public void paintBorder(Component c, Graphics g2, int x, int y, int width, int height) {
  if (DarculaTextFieldUI.isSearchField(c)) return;
  Graphics2D g = (Graphics2D)g2;
  final GraphicsConfig config = new GraphicsConfig(g);
  g.translate(x, y);

  if (c.hasFocus()) {
    DarculaUIUtil.paintFocusRing(g, 2, 2, width - 4, height - 4);
  }
  else {
    boolean editable = !(c instanceof JTextComponent) || ((JTextComponent)c).isEditable();
    g.setColor(getBorderColor(c.isEnabled() && editable));
    g.drawRect(1, 1, width - 2, height - 2);
  }
  g.translate(-x, -y);
  config.restore();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:DarculaTextBorder.java


示例6: paintRowData

import com.intellij.openapi.ui.GraphicsConfig; //导入依赖的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


示例7: paint

import com.intellij.openapi.ui.GraphicsConfig; //导入依赖的package包/类
@Override
public void paint(final Graphics g2, final JComponent c) {
  final Color borderColor = UIManager.getColor("TableHeader.borderColor");

  final Graphics2D g = (Graphics2D) g2;
  final GraphicsConfig config = new GraphicsConfig(g);
  final Color bg = c.getBackground();
  g.setColor(bg);
  final int h = c.getHeight();
  final int w = c.getWidth();
  g.fillRect(0, 0, w, h);

  g.setColor(borderColor);
  g.drawLine(0, h - 1, w, h - 1);

  config.restore();

  super.paint(g, c);
}
 
开发者ID:ChrisRM,项目名称:material-theme-jetbrains,代码行数:20,代码来源:MTTableHeaderUI.java


示例8: paintBackground

import com.intellij.openapi.ui.GraphicsConfig; //导入依赖的package包/类
@Override
protected void paintBackground(final Graphics graphics) {
  Graphics2D g = (Graphics2D) graphics;
  final JTextComponent c = getComponent();
  final Container parent = c.getParent();
  final Rectangle r = getDrawingRect();
  if (c.isOpaque() && parent != null) {
    g.setColor(parent.getBackground());
    g.fillRect(0, 0, c.getWidth(), c.getHeight());
  }
  final GraphicsConfig config = new GraphicsConfig(g);
  g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);

  final Border border = c.getBorder();
  if (isSearchField(c)) {
    paintSearchField(g, c, r, border);
  } else if (border instanceof MTTextBorder) {
    paintDarculaBackground(g, c, border);
  } else {
    super.paintBackground(g);
  }
  config.restore();
}
 
开发者ID:ChrisRM,项目名称:material-theme-jetbrains,代码行数:25,代码来源:MTTextFieldUI.java


示例9: paintFileColorGutter

import com.intellij.openapi.ui.GraphicsConfig; //导入依赖的package包/类
protected void paintFileColorGutter(final Graphics g) {
  final GraphicsConfig config = new GraphicsConfig(g);
  final Rectangle rect = getVisibleRect();
  final int firstVisibleRow = getClosestRowForLocation(rect.x, rect.y);
  final int lastVisibleRow = getClosestRowForLocation(rect.x, rect.y + rect.height);

  for (int row = firstVisibleRow; row <= lastVisibleRow; row++) {
    final TreePath path = getPathForRow(row);
    if (path != null) {
      final Rectangle bounds = getRowBounds(row);
      Object component = path.getLastPathComponent();
      final Object[] pathObjects = path.getPath();
      if (component instanceof LoadingNode && pathObjects.length > 1) {
        component = pathObjects[pathObjects.length - 2];
      }

      Color color = getFileColorFor(((DefaultMutableTreeNode)component));
      if (color != null) {
        g.setColor(color);
        g.fillRect(0, bounds.y, getWidth(), bounds.height);
      }
    }
  }
  config.restore();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:Tree.java


示例10: paintBorder

import com.intellij.openapi.ui.GraphicsConfig; //导入依赖的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


示例11: paintBorder

import com.intellij.openapi.ui.GraphicsConfig; //导入依赖的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;
  int offset = getOffset();
  if (c.hasFocus()) {
    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 + 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));
    g.drawRoundRect(x + offset, y + yOff, width - 2 * offset, height - 2*yOff, 5, 5);

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


示例12: paintBorder

import com.intellij.openapi.ui.GraphicsConfig; //导入依赖的package包/类
@Override
public void paintBorder(Component c, Graphics g2, int x, int y, int width, int height) {
  if (DarculaTextFieldUI.isSearchField(c)) return;
  Graphics2D g = ((Graphics2D)g2);
  final GraphicsConfig config = new GraphicsConfig(g);
  g.translate(x, y);

  if (c.hasFocus()) {
    DarculaUIUtil.paintFocusRing(g, 2, 2, width-4, height-4);
  } else {
    boolean editable = !(c instanceof JTextComponent) || (((JTextComponent)c).isEditable());
    g.setColor(c.isEnabled() && editable ? Gray._100 : new Color(0x535353));
    g.drawRect(1, 1, width - 2, height - 2);
  }
  g.translate(-x, -y);
  config.restore();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:DarculaTextBorder.java


示例13: paintFileColorGutter

import com.intellij.openapi.ui.GraphicsConfig; //导入依赖的package包/类
protected void paintFileColorGutter(final Graphics g) {
  final GraphicsConfig config = new GraphicsConfig(g);
  final Rectangle rect = getVisibleRect();
  final int firstVisibleRow = getClosestRowForLocation(rect.x, rect.y);
  final int lastVisibleRow = getClosestRowForLocation(rect.x, rect.y + rect.height);

  for (int row = firstVisibleRow; row <= lastVisibleRow; row++) {
    final TreePath path = getPathForRow(row);
    if (path != null) {
      final Rectangle bounds = getRowBounds(row);
      Object component = path.getLastPathComponent();
      final Object[] pathObjects = path.getPath();
      if (component instanceof LoadingNode && pathObjects.length > 1) {
        component = pathObjects[pathObjects.length - 2];
      }

      Color color = getFileColorFor(TreeUtil.getUserObject(component));
      if (color != null) {
        g.setColor(color);
        g.fillRect(0, bounds.y, getWidth(), bounds.height);
      }
    }
  }
  config.restore();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:Tree.java


示例14: paint

import com.intellij.openapi.ui.GraphicsConfig; //导入依赖的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


示例15: paint

import com.intellij.openapi.ui.GraphicsConfig; //导入依赖的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


示例16: paintIcon

import com.intellij.openapi.ui.GraphicsConfig; //导入依赖的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


示例17: paintBorder

import com.intellij.openapi.ui.GraphicsConfig; //导入依赖的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


示例18: paintBorder

import com.intellij.openapi.ui.GraphicsConfig; //导入依赖的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


示例19: paintBorder

import com.intellij.openapi.ui.GraphicsConfig; //导入依赖的package包/类
@Override
public void paintBorder(Component c, Graphics g2, int x, int y, int width, int height) {
  if (DarculaTextFieldUI.isSearchField(c)) return;
  Graphics2D g = ((Graphics2D)g2);
  final GraphicsConfig config = new GraphicsConfig(g);
  g.translate(x, y);

  if (c.hasFocus()) {
    DarculaUIUtil.paintFocusRing(g, new Rectangle(JBUI.scale(2), JBUI.scale(2), width - JBUI.scale(4), height - JBUI.scale(4)));
  }
  else {
    boolean editable = !(c instanceof JTextComponent) || (((JTextComponent)c).isEditable());
    g.setColor(c.isEnabled() && editable ? Gray._100 : new Color(0x535353));
    g.drawRect(JBUI.scale(1), JBUI.scale(1), width - JBUI.scale(2), height - JBUI.scale(2));
  }
  g.translate(-x, -y);
  config.restore();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:DarculaTextBorder.java


示例20: paint

import com.intellij.openapi.ui.GraphicsConfig; //导入依赖的package包/类
@Override
public void paint(Graphics g, JComponent c) {
  final Border border = c.getBorder();
  final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
  final boolean square = isSquare(c);
  if (c.isEnabled() && border != null) {
    final Insets ins = border.getBorderInsets(c);
    final int yOff = (ins.top + ins.bottom) / 4;
    if (!square) {
      if (((JButton)c).isDefaultButton()) {
        ((Graphics2D)g).setPaint(UIUtil.getGradientPaint(0, 0, getSelectedButtonColor1(), 0, c.getHeight(), getSelectedButtonColor2()));
      }
      else {
        ((Graphics2D)g).setPaint(UIUtil.getGradientPaint(0, 0, getButtonColor1(), 0, c.getHeight(), getButtonColor2()));
      }
    }
    g.fillRoundRect(JBUI.scale(square ? 2 : 4), yOff, c.getWidth() - JBUI.scale(8), c.getHeight() - 2 * yOff, JBUI.scale(square ? 3 : 5),
                    JBUI.scale(square ? 3 : 5));
  }
  config.restore();
  super.paint(g, c);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:DarculaButtonUI.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IStructureComparator类代码示例发布时间:2022-05-22
下一篇:
Java IdleHandler类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap