Here you can find the source of drawArrowHead(Graphics g, double c1, double c2, double phi, int l, int grad, boolean fill)
public static void drawArrowHead(Graphics g, double c1, double c2, double phi, int l, int grad, boolean fill)
//package com.java2s; //License from project: Open Source License import java.awt.Graphics; public class Main { public static void drawArrowHead(Graphics g, double c1, double c2, double phi, int l, int grad, boolean fill) { phi = (phi + 180) % 360;//from w w w.j av a 2 s. c o m int px = (int) (c1 + Math.cos((2 * Math.PI * (phi + grad) / 360)) * l); int py = (int) (c2 - Math.sin((2 * Math.PI * (phi + grad) / 360)) * l); int px2 = (int) (c1 + Math.cos((2 * Math.PI * (phi - grad) / 360)) * l); int py2 = (int) (c2 - Math.sin((2 * Math.PI * (phi - grad) / 360)) * l); if (fill) { g.fillPolygon(new int[] { (int) c1, px, px2 }, new int[] { (int) c2, py, py2 }, 3); } else { g.drawLine((int) c1, (int) c2, px, py); g.drawLine((int) c1, (int) c2, px2, py2); } } }