Mihail Mihaylov wrote:

> I want to add a small circle at the end of a line. Whenever I drag the 
> line, with my mouse or rotate it around, I want the circle to get 
> updated appropriately and to be at the end of that line.

Do you want the circle to be centred upon the line's endpoint, or to
be centred on the line and touching the endpoint?

Assuming it's the latter, try:

Graphics g;
int radius;

void DrawCircle(int x0, int y0, int x1, int y1)
{
        double vx = x1 - x0;
        double vy = y1 - y0;

        double d = Math.sqrt(vx * vx + vy * vy);
        vx /= d;
        vy /= d;

        int x = x1 + radius * vx;
        int y = y1 + radius * vy;

        g.drawOval(
                x - radius, y - radius,
                radius * 2, radius * 2
        );
}

>  How can I join the newsgroup?

Newsgroup?

-- 
Glynn Clements <[EMAIL PROTECTED]>

Reply via email to