Java tutorial
//package com.java2s; import java.awt.geom.Area; import java.awt.geom.GeneralPath; import java.awt.geom.Point2D; public class Main { public static Area getArrowFromTo(Point2D.Double from, Point2D.Double to) { double dx = 8; double dy = Math.floor(dx / 2); if (from.getX() < to.getX()) dx *= -1; GeneralPath arrowHeadFrom = new GeneralPath(); arrowHeadFrom.moveTo(to.getX() + dx, to.getY() - dy); arrowHeadFrom.lineTo(to.getX(), to.getY()); arrowHeadFrom.lineTo(to.getX() + dx, to.getY() + dy); arrowHeadFrom.lineTo(to.getX() + dx, to.getY() + 0.1); arrowHeadFrom.lineTo(from.getX(), from.getY() + 0.1); arrowHeadFrom.lineTo(from.getX(), from.getY() - 0.1); arrowHeadFrom.lineTo(to.getX() + dx, to.getY() - 0.1); arrowHeadFrom.lineTo(to.getX() + dx, to.getY() - dy); Area b = new Area(arrowHeadFrom); return b; } }