Here you can find the source of paintArrow(Graphics g, int x0, int y0, int x1, int y1)
public static void paintArrow(Graphics g, int x0, int y0, int x1, int y1)
//package com.java2s; //License from project: Open Source License import java.awt.*; public class Main { public static void paintArrow(Graphics g, int x0, int y0, int x1, int y1) { int deltaX = x1 - x0; int deltaY = y1 - y0; double frac = 0.2; g.drawLine(x0, y0, x1, y1);/*from w w w .j ava2 s .c o m*/ g.drawLine(x0 + (int) ((1 - frac) * deltaX + frac * deltaY), y0 + (int) ((1 - frac) * deltaY - frac * deltaX), x1, y1); g.drawLine(x0 + (int) ((1 - frac) * deltaX - frac * deltaY), y0 + (int) ((1 - frac) * deltaY + frac * deltaX), x1, y1); } }