public void lineArrow(final int x0,final int y0,final int x1,final int y1,final int sidelength,final int padding,final long lineColor,final long arrowColor){
  final double dx=x1 - x0;
  final double dy=y1 - y0;
  final double angle=Math.atan2(dy,dx);
  final double d=Math.sqrt((dx * dx + dy * dy));
  final double arrowtip=d - padding;
  final double arrowlength=TL * sidelength;
  final double arrowbase=arrowtip - arrowlength;
  final double xn=Math.cos(angle);
  final double yn=Math.sin(angle);
  final int xt=x0 + ((int)(arrowtip * xn));
  final int yt=y0 + ((int)(arrowtip * yn));
  final double xb=x0 + arrowbase * xn;
  final double yb=y0 + arrowbase * yn;
  final double sl2=sidelength / 2.0;
  final double xk=sl2 * Math.cos(angle + PI2);
  final double yk=sl2 * Math.sin(angle + PI2);
  final int x2=(int)(xb + xk);
  final int y2=(int)(yb + yk);
  final int x3=(int)(xb - xk);
  final int y3=(int)(yb - yk);
  setColor(lineColor);
  line(x0,y0,(int)xb,(int)yb,100);
  setColor(arrowColor);
  line(x2,y2,x3,y3,100);
  line(x2,y2,xt,yt,100);
  line(x3,y3,xt,yt,100);
}

public void lineArrow ( final int x0 , final int y0 , final int x1 , final int y1 , final int sidelength , final int padding , final long lineColor , final long arrowColor ) { final double dx = x1 - x0 ; final double dy = y1 - y0 ; final double angle = Math . atan2 ( dy , dx ) ; final double d = Math . sqrt ( ( dx * dx + dy * dy ) ) ; final double arrowtip = d - padding ; final double arrowlength = TL * sidelength ; final double arrowbase = arrowtip - arrowlength ; final double xn = Math . cos ( angle ) ; final double yn = Math . sin ( angle ) ; final int xt = x0 + ( ( int ) ( arrowtip * xn ) ) ; final int yt = y0 + ( ( int ) ( arrowtip * yn ) ) ; final double xb = x0 + arrowbase * xn ; final double yb = y0 + arrowbase * yn ; final double sl2 = sidelength / 2.0 ; final double xk = sl2 * Math . cos ( angle + PI2 ) ; final double yk = sl2 * Math . sin ( angle + PI2 ) ; final int x2 = ( int ) ( xb + xk ) ; final int y2 = ( int ) ( yb + yk ) ; final int x3 = ( int ) ( xb - xk ) ; final int y3 = ( int ) ( yb - yk ) ; setColor ( lineColor ) ; line ( x0 , y0 , ( int ) xb , ( int ) yb , 100 ) ; setColor ( arrowColor ) ; line ( x2 , y2 , x3 , y3 , 100 ) ; line ( x2 , y2 , xt , yt , 100 ) ; line ( x3 , y3 , xt , yt , 100 ) ; }
draw a line with an arrow at the end
