I believe you cannot click on a "thread". You to determine out how to detect click events on the various bouncing ball elements - whatever they may be, use that to change some state variable, and have each thread tracking the state variables. It would be very helpful if you described what you are using to draw the balls with separate threads.
One way to accomplish your goals is to have an array of boolean values...
class BallTracker {
public boolean ballIsPaused[5];
}
create one instance of this:
BallTracker myBallTracker = new BallTracker();
Pass myBallTracker to your code that is running in the threads, so that the threads can check the status, and if ballIsPaused[ballNum] becomes true, then do whatever you need to in the code pause or end the thread.
So the ball bouncing code would look something like this:
if(ballTracker.ballIsPaused[ballNum])
PauseOrKillThread(); //ball is now paused, so do something to wait for unpausing, or kill thread, or something similiar
UpdateAnimation();
Sleep(15); //sleep for 15 ms, I don't know what the real function for this is
Whatever you click detect code does would look something like this:
void OnClick(int ballNum) {
ballTracker.ballIsPaused[ballNum] = true;
}
That is a basic idea of what you need to do - use one common object that each thread as manipulating to change and react to the state.
There are probably many ways to do this, but hopefully this gives you something to start with.