Swing along the tangent.

Hello,
I am am stuck with my java code. Need help. I have been trying to create a swing movement for an animated java ball. I have managed to get the ball moving in a circular manner. With this:

 theta = theta + Math.toRadians(10); 
x = a + r*Math.cos(theta);
y = b + r*Math.sin(theta) ;

This just sets the ball in circular motion. I am wanting to swing the ball from particular point in a motion of a tangent to the circle as given in the image figure below. Could anyone please help me with this?