How to draw Arrow Line in Applet Java code example

public static void drawArrowLine(Graphics g, int i, int j, int k, int l, int i1)
    {
        double d = Math.sqrt((k - i) * (k - i) + (l - j) * (l - j));
        double d1 = (double)(-(k - i)) / (double)(l - j);
        double d2 = 6D / Math.sqrt(1.0D + d1 * d1);
        double d3 = 6D / Math.sqrt(1.0D + 1.0D / d1 / d1);
        if(d1 < 0.0D)
            d3 = -d3;
        double d4 = (double)k - (double)(10 * (k - i)) / d;
        double d5 = (double)l - (double)(10 * (l - j)) / d;
        drawLine(g, i, j, (int)d4, (int)d5, i1);
        int ai[] = {
            (int)(d4 - d2), k, (int)(d4 + d2)
        };
        int ai1[] = {
            (int)(d5 - d3), l, (int)(d5 + d3)
        };
        g.fillPolygon(ai, ai1, 3);
    }
}

Popular posts from this blog

What is NBioBSP Java Library?

Draw arrow line example

Capture image from webcam java code, examples