Java Code Examples for java.awt.Graphics2D#drawPolyline()

The following examples show how to use java.awt.Graphics2D#drawPolyline() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: osp   File: ElementArrow.java    License: GNU General Public License v3.0 6 votes vote down vote up
private void drawHead(Graphics2D _g2, int a1, int b1, Color _color, Color _fill) {
  _g2.setStroke(getRealStyle().getLineStroke());
  if(headPoints==0) {
    _g2.setColor(_color);
    _g2.drawLine(a1, b1, aCoord[div], bCoord[div]);
    return;
  }
  int n = headPoints-1;
  headA[n] = a1;
  headB[n] = b1;
  if((_fill!=null)&&getRealStyle().isDrawingFill()) {
    _g2.setPaint(_fill);
    _g2.fillPolygon(headA, headB, n);
  }
  _g2.setColor(_color);
  _g2.drawPolyline(headA, headB, headPoints);
}
 
Example 2
Source Project: brModelo   File: Linha.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public void DoPaint(Graphics2D g) {
    super.DoPaint(g);
    Stroke bkp = g.getStroke();

    g.setPaint(getForeColor());
    if (getPontosParaDesenho() != null) {
        if (isDashed()) {
            g.setStroke(new BasicStroke(getLargura(), BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[]{1, 2}, 0));
        } else {
            g.setStroke(new BasicStroke(
                    getLargura(),
                    BasicStroke.CAP_ROUND,
                    BasicStroke.JOIN_ROUND));
        }

        g.drawPolyline(pontosParaDesenhoX, pontosParaDesenhoY, pontosParaDesenhoX.length);
    }
    g.setStroke(bkp);
}
 
Example 3
private static void test(final Graphics2D g, final int[] arr) {
    g.drawPolygon(arr, arr, arr.length);
    g.drawPolygon(new Polygon(arr, arr, arr.length));
    g.fillPolygon(arr, arr, arr.length);
    g.fillPolygon(new Polygon(arr, arr, arr.length));
    g.drawPolyline(arr, arr, arr.length);
}
 
Example 4
private static void test(final Graphics2D g, final int[] arr) {
    g.drawPolygon(arr, arr, arr.length);
    g.drawPolygon(new Polygon(arr, arr, arr.length));
    g.fillPolygon(arr, arr, arr.length);
    g.fillPolygon(new Polygon(arr, arr, arr.length));
    g.drawPolyline(arr, arr, arr.length);
}
 
Example 5
Source Project: hottub   File: Test8004821.java    License: GNU General Public License v2.0 5 votes vote down vote up
private static void test(final Graphics2D g, final int[] arr) {
    g.drawPolygon(arr, arr, arr.length);
    g.drawPolygon(new Polygon(arr, arr, arr.length));
    g.fillPolygon(arr, arr, arr.length);
    g.fillPolygon(new Polygon(arr, arr, arr.length));
    g.drawPolyline(arr, arr, arr.length);
}
 
Example 6
private static void test(final Graphics2D g, final int[] arr) {
    g.drawPolygon(arr, arr, arr.length);
    g.drawPolygon(new Polygon(arr, arr, arr.length));
    g.fillPolygon(arr, arr, arr.length);
    g.fillPolygon(new Polygon(arr, arr, arr.length));
    g.drawPolyline(arr, arr, arr.length);
}
 
Example 7
private static void test(final Graphics2D g, final int[] arr) {
    g.drawPolygon(arr, arr, arr.length);
    g.drawPolygon(new Polygon(arr, arr, arr.length));
    g.fillPolygon(arr, arr, arr.length);
    g.fillPolygon(new Polygon(arr, arr, arr.length));
    g.drawPolyline(arr, arr, arr.length);
}
 
Example 8
private static void test(final Graphics2D g, final int[] arr) {
    g.drawPolygon(arr, arr, arr.length);
    g.drawPolygon(new Polygon(arr, arr, arr.length));
    g.fillPolygon(arr, arr, arr.length);
    g.fillPolygon(new Polygon(arr, arr, arr.length));
    g.drawPolyline(arr, arr, arr.length);
}
 
Example 9
protected void paint(XYItem item, List<ItemSelection> highlighted,
                     List<ItemSelection> selected, Graphics2D g,
                     Rectangle dirtyArea, SynchronousXYChartContext context) {

    int valuesCount = item.getValuesCount();
    int extraTrailing = fillColor != null ? 2 : 0;

    Rectangle dirtyExtended = new Rectangle(dirtyArea);
    dirtyExtended.x -= lineWidth;
    dirtyExtended.width += lineWidth * 2;
    int[][] idxs = computer.getVisible(dirtyExtended, valuesCount, context, 1,
                                       extraTrailing);
    if (idxs == null) return;
    int[] visibleIndexes = idxs[0];
    int npoints = idxs[1][0];
    int[][] points = computer.createPoints(visibleIndexes, npoints, item,
                                           dataFactor, context);

    if (fillColor != null) {
        points[0][npoints - 2] = points[0][npoints - 3];
        points[1][npoints - 2] = computer.getZeroY(context);
        points[0][npoints - 1] = points[0][0];
        points[1][npoints - 1] = points[1][npoints - 2];

        POLYGON.xpoints = points[0];
        POLYGON.ypoints = points[1];
        POLYGON.npoints = npoints;

        g.setPaint(fillColor);
        g.fill(POLYGON);
    }

    if (lineColor != null) {
        g.setPaint(lineColor);
        g.setStroke(lineStroke);
        g.drawPolyline(points[0], points[1], npoints - extraTrailing);
    }
}
 
Example 10
private static void test(final Graphics2D g, final int[] arr) {
    g.drawPolygon(arr, arr, arr.length);
    g.drawPolygon(new Polygon(arr, arr, arr.length));
    g.fillPolygon(arr, arr, arr.length);
    g.fillPolygon(new Polygon(arr, arr, arr.length));
    g.drawPolyline(arr, arr, arr.length);
}
 
Example 11
private static void test(final Graphics2D g, final int[] arr) {
    g.drawPolygon(arr, arr, arr.length);
    g.drawPolygon(new Polygon(arr, arr, arr.length));
    g.fillPolygon(arr, arr, arr.length);
    g.fillPolygon(new Polygon(arr, arr, arr.length));
    g.drawPolyline(arr, arr, arr.length);
}
 
Example 12
@Override
public void paintInstance(InstancePainter painter) {
	Graphics2D g = (Graphics2D) painter.getGraphics();
	Bounds bds = painter.getInstance().getBounds();
	int x = bds.getX();
	int y = bds.getY();
	g.setColor(painter.getAttributeValue(StdAttr.ATTR_LABEL_COLOR));
	painter.drawLabel();
	g.setColor(Color.BLACK);
	boolean drawUp;
	if (painter.getShowState()) {
		ProgrammableGeneratorState state = getState(painter);
		painter.drawRoundBounds(state.sending.getColor());
		drawUp = state.sending == Value.TRUE;
	} else {
		painter.drawBounds(Color.BLACK);
		drawUp = true;
	}
	g.setColor(Color.WHITE);
	x += 10;
	y += 10;
	int[] xs = { x + 1, x + 1, x + 4, x + 4, x + 7, x + 7 };
	int[] ys;
	if (drawUp) {
		ys = new int[] { y + 5, y + 3, y + 3, y + 7, y + 7, y + 5 };
	} else {
		ys = new int[] { y + 5, y + 7, y + 7, y + 3, y + 3, y + 5 };
	}
	g.drawPolyline(xs, ys, xs.length);
	GraphicsUtil.switchToWidth(g, 2);
	xs = new int[] { x - 5, x - 5, x + 1, x + 1, x - 4 };
	ys = new int[] { y + 5, y - 5, y - 5, y, y };
	g.drawPolyline(xs, ys, xs.length);
	painter.drawPorts();
}
 
Example 13
Source Project: oim-fx   File: JIMHistoryTextPane.java    License: MIT License 4 votes vote down vote up
@Override
public void paintComponent(Graphics g) {
	Graphics2D g2D = (Graphics2D) g;
	g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // 反锯齿平滑绘制

	// 通过对并发消息链表遍历绘制全部消息气泡、消息发出者头像
	if (messageConcurrentLinkedQueue != null) {
		Iterator<Message> iterator = messageConcurrentLinkedQueue.iterator();
		while (iterator.hasNext()) {
			Message message = iterator.next();

			Point point = message.getMessagePaintLeftTop();

			if (point != null) {
				// 绘制消息发出者头像
				if (senderHeadImageConcurrentHashMap != null) {
					Image image = senderHeadImageConcurrentHashMap.get(message.getSenderHeadImageID());
					if (image != null) {
						if (message.isSelfSender()) {
							g2D.drawImage(image, this.getWidth() - image.getWidth(null) - 9, point.y - 25, null);
						} else {
							// 消息发出者是别人,则头像靠左显示
							g2D.drawImage(image, 9, point.y - 25, null);
						}
					}
				}

				// 绘制额消息气泡左边小箭头
				int xPoints[] = new int[3];
				int yPoints[] = new int[3];

				if (message.isSelfSender()) {
					// 绘制自己消息圆角消息气泡矩形
					g2D.setColor(selfMessageColor);
					g2D.fillRoundRect(point.x - 7, point.y - 7, message.getMessagePaintWidth() + 14, message.getMessagePaintHeight() + 14, 10, 10);
					// 绘制圆角消息气泡边框
					g2D.setColor(selfMessageBorderColor);
					g2D.drawRoundRect(point.x - 7, point.y - 7, message.getMessagePaintWidth() + 14, message.getMessagePaintHeight() + 14, 10, 10);

					// 消息发出者是自己,则头像靠右显示
					xPoints[0] = (point.x - 7) + (message.getMessagePaintWidth() + 14);
					yPoints[0] = point.y;
					xPoints[1] = xPoints[0] + 7;
					yPoints[1] = point.y;
					xPoints[2] = xPoints[0];
					yPoints[2] = point.y + 7;

					g2D.setColor(selfMessageColor);
					g2D.fillPolygon(xPoints, yPoints, 3);
					g2D.setColor(selfMessageBorderColor);
					g2D.drawPolyline(xPoints, yPoints, 3);
					g2D.setColor(selfMessageColor);
					g2D.drawLine(xPoints[0], yPoints[0] + 1, xPoints[2], yPoints[2] - 1);
				} else {
					// 绘制别人消息圆角消息气泡矩形
					// 绘制圆角消息气泡矩形
					g2D.setColor(otherMessageColor);
					g2D.fillRoundRect(point.x - 7, point.y - 7, message.getMessagePaintWidth() + 14, message.getMessagePaintHeight() + 14, 10, 10);
					// 绘制圆角消息气泡边框
					g2D.setColor(otherMessageBorderColor);
					g2D.drawRoundRect(point.x - 7, point.y - 7, message.getMessagePaintWidth() + 14, message.getMessagePaintHeight() + 14, 10, 10);

					// 消息发出者是别人,则头像靠左显示
					xPoints[0] = point.x - 7;
					yPoints[0] = point.y;
					xPoints[1] = xPoints[0] - 7;
					yPoints[1] = point.y;
					xPoints[2] = xPoints[0];
					yPoints[2] = point.y + 7;

					g2D.setColor(otherMessageColor);
					g2D.fillPolygon(xPoints, yPoints, 3);
					g2D.setColor(otherMessageBorderColor);
					g2D.drawPolyline(xPoints, yPoints, 3);
					g2D.setColor(otherMessageColor);
					g2D.drawLine(xPoints[0], yPoints[0] + 1, xPoints[2], yPoints[2] - 1);
				}
			}
		} // while
	}

	super.paintComponent(g); // 执行默认组件绘制(消息文本、图片以及段落显示等内容)
}
 
Example 14
@Override
protected void paintWidget() {
    Graphics2D g = this.getGraphics();

    if (xPoints.length == 0 || Math.abs(xPoints[0] - xPoints[xPoints.length - 1]) > 2000) {
        return;
    }

    //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
    //g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
    //g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);

    DiagramScene ds = (DiagramScene) this.getScene();
    boolean shouldHide = false;//ds.getShouldHide(this);

    Composite oldComposite = null;
    if (shouldHide) {
        Color c = new Color(255 - (255 - color.getRed()) / WHITE_FACTOR, 255 - (255 - color.getGreen()) / WHITE_FACTOR, 255 - (255 - color.getBlue()) / WHITE_FACTOR);
        g.setPaint(c);
    } else {
        g.setPaint(color);
    }

    if (split) {
        for (int i = 1; i < controlPoints.size(); i++) {
            Point prev = controlPoints.get(i - 1);
            Point cur = controlPoints.get(i);
            if (cur == null || prev == null) {
                continue;
            }

            g.drawLine(prev.x, prev.y, cur.x, cur.y);
        }
    } else {
        g.drawPolyline(xPoints, yPoints, pointCount);
    }

    /*for(int i=0; i<xPoints.length; i++) {
    int x = xPoints[i];
    int y = yPoints[i];
    g.fillOval(x - 2, y - 2, 4, 4);
    }*/

    if (xPoints.length >= 2) {
        Graphics2D g2 = (Graphics2D) g.create();
        int xOff = xPoints[xPoints.length - 2] - xPoints[xPoints.length - 1];
        int yOff = yPoints[yPoints.length - 2] - yPoints[yPoints.length - 1];
        if (xOff == 0 && yOff == 0 && yPoints.length >= 3) {
            xOff = xPoints[xPoints.length - 3] - xPoints[xPoints.length - 1];
            yOff = yPoints[yPoints.length - 3] - yPoints[yPoints.length - 1];
        }
        g2.translate(xPoints[xPoints.length - 1], yPoints[yPoints.length - 1]);
        g2.rotate(Math.atan2(yOff, xOff));

        g2.scale(0.55, 0.80);
        AnchorShape.TRIANGLE_FILLED.paint(g2, false);
    }
}
 
Example 15
@Override
protected void paintWidget() {
    Graphics2D g = this.getGraphics();

    if (xPoints.length == 0 || Math.abs(xPoints[0] - xPoints[xPoints.length - 1]) > 2000) {
        return;
    }

    //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
    //g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
    //g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);

    DiagramScene ds = (DiagramScene) this.getScene();
    boolean shouldHide = false;//ds.getShouldHide(this);

    Composite oldComposite = null;
    if (shouldHide) {
        Color c = new Color(255 - (255 - color.getRed()) / WHITE_FACTOR, 255 - (255 - color.getGreen()) / WHITE_FACTOR, 255 - (255 - color.getBlue()) / WHITE_FACTOR);
        g.setPaint(c);
    } else {
        g.setPaint(color);
    }

    if (split) {
        for (int i = 1; i < controlPoints.size(); i++) {
            Point prev = controlPoints.get(i - 1);
            Point cur = controlPoints.get(i);
            if (cur == null || prev == null) {
                continue;
            }

            g.drawLine(prev.x, prev.y, cur.x, cur.y);
        }
    } else {
        g.drawPolyline(xPoints, yPoints, pointCount);
    }

    /*for(int i=0; i<xPoints.length; i++) {
    int x = xPoints[i];
    int y = yPoints[i];
    g.fillOval(x - 2, y - 2, 4, 4);
    }*/

    if (xPoints.length >= 2) {
        Graphics2D g2 = (Graphics2D) g.create();
        int xOff = xPoints[xPoints.length - 2] - xPoints[xPoints.length - 1];
        int yOff = yPoints[yPoints.length - 2] - yPoints[yPoints.length - 1];
        if (xOff == 0 && yOff == 0 && yPoints.length >= 3) {
            xOff = xPoints[xPoints.length - 3] - xPoints[xPoints.length - 1];
            yOff = yPoints[yPoints.length - 3] - yPoints[yPoints.length - 1];
        }
        g2.translate(xPoints[xPoints.length - 1], yPoints[yPoints.length - 1]);
        g2.rotate(Math.atan2(yOff, xOff));

        g2.scale(0.55, 0.80);
        AnchorShape.TRIANGLE_FILLED.paint(g2, false);
    }
}
 
Example 16
protected void paint(XYItem item, List<ItemSelection> highlighted,
                       List<ItemSelection> selected, Graphics2D g,
                       Rectangle dirtyArea, SynchronousXYChartContext context) {

        if (item.getValuesCount() < 2) return;
        if (context.getViewWidth() == 0 || context.getViewHeight() == 0) return;

        int[][] points = createPoints(item, dirtyArea, context, type, maxValueOffset);
        if (points == null) return;

        int[] xPoints  = points[0];
        int[] yPoints  = points[1];
        int npoints = xPoints.length;

//long start = System.nanoTime();
        if (fillColor != null) {
            int zeroY = Utils.checkedInt(context.getViewY(context.getDataOffsetY()));
            zeroY = Math.max(Utils.checkedInt(context.getViewportOffsetY()), zeroY);
            zeroY = Math.min(Utils.checkedInt(context.getViewportOffsetY() +
                                                      context.getViewportHeight()), zeroY);

            Polygon polygon = new Polygon();
            polygon.xpoints = xPoints;
            polygon.ypoints = yPoints;
            polygon.npoints = npoints;
            polygon.xpoints[npoints - 2] = xPoints[npoints - 3];
            polygon.ypoints[npoints - 2] = zeroY;
            polygon.xpoints[npoints - 1] = xPoints[0];
            polygon.ypoints[npoints - 1] = zeroY;
            g.setPaint(fillColor);
            g.fill(polygon);
        }

        if (lineColor != null) {
            g.setPaint(lineColor);
            g.setStroke(lineStroke);
            g.drawPolyline(xPoints, yPoints, npoints - 2);
        }
//System.err.println(">>> Paint: " + (System.nanoTime() - start) / 1000 + " [ms], dirtyArea: " + dirtyArea);
//        if (type == TYPE_RELATIVE) {
//        g.setColor(Color.RED);
//        Rectangle bbox = new Rectangle(dirtyArea);
////        bbox.width -= 1;
////        bbox.height -= 1;
//            g.draw(bbox);
////            System.err.println(">>> Here");
//        }

//        if (type == TYPE_RELATIVE_BOUNDED) {
//            System.err.println(">>> paintItem, dirtyArea: " + dirtyArea);
//        }
        
    }
 
Example 17
Source Project: visualvm   File: XYPainter.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected void paint(XYItem item, List<ItemSelection> highlighted,
                   List<ItemSelection> selected, Graphics2D g,
                   Rectangle dirtyArea, SynchronousXYChartContext context) {
    
    if (!isPainting()) return;
    if (item.getValuesCount() < 2) return;
    if (context.getViewWidth() == 0 || context.getViewHeight() == 0) return;

    int[][] points = getPoints(item, dirtyArea, context, type, maxValueOffset);
    if (points == null) return;

    int[] xPoints  = points[0];
    int[] yPoints  = points[1];
    int npoints = points[2][0];
    
    if (fillColor != null) {
        int zeroY = Utils.checkedInt(context.getViewY(context.getDataOffsetY()));
        zeroY = Math.max(Utils.checkedInt(context.getViewportOffsetY()), zeroY);
        zeroY = Math.min(Utils.checkedInt(context.getViewportOffsetY() +
                                                  context.getViewportHeight()), zeroY);

        Polygon polygon = new Polygon();
        polygon.xpoints = xPoints;
        polygon.ypoints = yPoints;
        polygon.npoints = npoints + 2;
        polygon.xpoints[npoints] = xPoints[npoints - 1];
        polygon.ypoints[npoints] = zeroY;
        polygon.xpoints[npoints + 1] = xPoints[0];
        polygon.ypoints[npoints + 1] = zeroY;
        
        if (fillColor2 == null || Utils.forceSpeed()) g.setPaint(fillColor);
        else g.setPaint(new GradientPaint(0, context.getViewportOffsetY(),
                       fillColor, 0, context.getViewportOffsetY() +
                       context.getViewportHeight(), fillColor2));
        g.fill(polygon);
    }

    if (lineColor != null) {
        g.setPaint(lineColor);
        g.setStroke(lineStroke);
        g.drawPolyline(xPoints, yPoints, npoints);
    }

}
 
Example 18
private void drawPolylineBAD(Graphics2D g, int[] xp, int[] yp) {
    int offset = 200;
    g.translate(0, offset);
    g.drawPolyline(xp, yp, xp.length);
}
 
Example 19
@Override
protected void paintWidget() {
    Graphics2D g = this.getGraphics();

    if (xPoints.length == 0 || Math.abs(xPoints[0] - xPoints[xPoints.length - 1]) > 2000) {
        return;
    }

    //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
    //g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
    //g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);

    DiagramScene ds = (DiagramScene) this.getScene();
    boolean shouldHide = false;//ds.getShouldHide(this);

    Composite oldComposite = null;
    if (shouldHide) {
        Color c = new Color(255 - (255 - color.getRed()) / WHITE_FACTOR, 255 - (255 - color.getGreen()) / WHITE_FACTOR, 255 - (255 - color.getBlue()) / WHITE_FACTOR);
        g.setPaint(c);
    } else {
        g.setPaint(color);
    }

    if (split) {
        for (int i = 1; i < controlPoints.size(); i++) {
            Point prev = controlPoints.get(i - 1);
            Point cur = controlPoints.get(i);
            if (cur == null || prev == null) {
                continue;
            }

            g.drawLine(prev.x, prev.y, cur.x, cur.y);
        }
    } else {
        g.drawPolyline(xPoints, yPoints, pointCount);
    }

    /*for(int i=0; i<xPoints.length; i++) {
    int x = xPoints[i];
    int y = yPoints[i];
    g.fillOval(x - 2, y - 2, 4, 4);
    }*/

    if (xPoints.length >= 2) {
        Graphics2D g2 = (Graphics2D) g.create();
        int xOff = xPoints[xPoints.length - 2] - xPoints[xPoints.length - 1];
        int yOff = yPoints[yPoints.length - 2] - yPoints[yPoints.length - 1];
        if (xOff == 0 && yOff == 0 && yPoints.length >= 3) {
            xOff = xPoints[xPoints.length - 3] - xPoints[xPoints.length - 1];
            yOff = yPoints[yPoints.length - 3] - yPoints[yPoints.length - 1];
        }
        g2.translate(xPoints[xPoints.length - 1], yPoints[yPoints.length - 1]);
        g2.rotate(Math.atan2(yOff, xOff));

        g2.scale(0.55, 0.80);
        AnchorShape.TRIANGLE_FILLED.paint(g2, false);
    }
}
 
Example 20
@Override
protected void paintWidget() {
    Graphics2D g = this.getGraphics();

    if (xPoints.length == 0 || Math.abs(xPoints[0] - xPoints[xPoints.length - 1]) > 2000) {
        return;
    }

    //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
    //g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
    //g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);

    DiagramScene ds = (DiagramScene) this.getScene();
    boolean shouldHide = false;//ds.getShouldHide(this);

    Composite oldComposite = null;
    if (shouldHide) {
        Color c = new Color(255 - (255 - color.getRed()) / WHITE_FACTOR, 255 - (255 - color.getGreen()) / WHITE_FACTOR, 255 - (255 - color.getBlue()) / WHITE_FACTOR);
        g.setPaint(c);
    } else {
        g.setPaint(color);
    }

    if (split) {
        for (int i = 1; i < controlPoints.size(); i++) {
            Point prev = controlPoints.get(i - 1);
            Point cur = controlPoints.get(i);
            if (cur == null || prev == null) {
                continue;
            }

            g.drawLine(prev.x, prev.y, cur.x, cur.y);
        }
    } else {
        g.drawPolyline(xPoints, yPoints, pointCount);
    }

    /*for(int i=0; i<xPoints.length; i++) {
    int x = xPoints[i];
    int y = yPoints[i];
    g.fillOval(x - 2, y - 2, 4, 4);
    }*/

    if (xPoints.length >= 2) {
        Graphics2D g2 = (Graphics2D) g.create();
        int xOff = xPoints[xPoints.length - 2] - xPoints[xPoints.length - 1];
        int yOff = yPoints[yPoints.length - 2] - yPoints[yPoints.length - 1];
        if (xOff == 0 && yOff == 0 && yPoints.length >= 3) {
            xOff = xPoints[xPoints.length - 3] - xPoints[xPoints.length - 1];
            yOff = yPoints[yPoints.length - 3] - yPoints[yPoints.length - 1];
        }
        g2.translate(xPoints[xPoints.length - 1], yPoints[yPoints.length - 1]);
        g2.rotate(Math.atan2(yOff, xOff));

        g2.scale(0.55, 0.80);
        AnchorShape.TRIANGLE_FILLED.paint(g2, false);
    }
}