Java 类com.intellij.ui.LineEndDecorator 实例源码

项目:intellij-ce-playground    文件:CalloutComponent.java   
protected void paintComponent(Graphics g) {
  Graphics2D g2 = (Graphics2D) g;

  final Object old = g2.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
  g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

  g2.setColor(getBoundsColor());

  Line2D line = new Line2D.Double();
  switch (myOrientation) {
    case Callout.NORTH_WEST:
      line.setLine(0, 0, getWidth() - 1, getHeight() - 1);
      break;
    case Callout.NORTH_EAST:
      line.setLine(getWidth() - 1, 0, 0, getHeight() -1);
      break;
    case Callout.SOUTH_EAST:
      line.setLine(getWidth() - 1, getHeight() - 1, 0, 0);
      break;
    case Callout.SOUTH_WEST:
      line.setLine(0, getHeight() - 1, getWidth() - 1, 0);
      break;
  }

  UIUtil.drawLine(g2, (int)line.getX1(), (int)line.getY1(), (int)line.getX2(), (int)line.getY2());

  final Shape arrow = LineEndDecorator.getArrowShape(line, line.getP2());
  g2.fill(arrow);

  g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, old);
}
项目:tools-idea    文件:CalloutComponent.java   
protected void paintComponent(Graphics g) {
  Graphics2D g2 = (Graphics2D) g;

  final Object old = g2.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
  g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

  g2.setColor(getBoundsColor());

  Line2D line = new Line2D.Double();
  switch (myOrientation) {
    case Callout.NORTH_WEST:
      line.setLine(0, 0, getWidth() - 1, getHeight() - 1);
      break;
    case Callout.NORTH_EAST:
      line.setLine(getWidth() - 1, 0, 0, getHeight() -1);
      break;
    case Callout.SOUTH_EAST:
      line.setLine(getWidth() - 1, getHeight() - 1, 0, 0);
      break;
    case Callout.SOUTH_WEST:
      line.setLine(0, getHeight() - 1, getWidth() - 1, 0);
      break;
  }

  UIUtil.drawLine(g2, (int)line.getX1(), (int)line.getY1(), (int)line.getX2(), (int)line.getY2());

  final Shape arrow = LineEndDecorator.getArrowShape(line, line.getP2());
  g2.fill(arrow);

  g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, old);
}
项目:consulo    文件:CalloutComponent.java   
protected void paintComponent(Graphics g) {
  Graphics2D g2 = (Graphics2D) g;

  final Object old = g2.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
  g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

  g2.setColor(getBoundsColor());

  Line2D line = new Line2D.Double();
  switch (myOrientation) {
    case Callout.NORTH_WEST:
      line.setLine(0, 0, getWidth() - 1, getHeight() - 1);
      break;
    case Callout.NORTH_EAST:
      line.setLine(getWidth() - 1, 0, 0, getHeight() -1);
      break;
    case Callout.SOUTH_EAST:
      line.setLine(getWidth() - 1, getHeight() - 1, 0, 0);
      break;
    case Callout.SOUTH_WEST:
      line.setLine(0, getHeight() - 1, getWidth() - 1, 0);
      break;
  }

  UIUtil.drawLine(g2, (int)line.getX1(), (int)line.getY1(), (int)line.getX2(), (int)line.getY2());

  final Shape arrow = LineEndDecorator.getArrowShape(line, line.getP2());
  g2.fill(arrow);

  g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, old);
}