Two ways I can think off. In your run method you will have to set up a flag
which is checked 

say you can put the entire thing in say 

while( flag )
{....
}

So your run methods exits when the flag is put to false in the
actionPerformed() method of the mouseListener on your buttons.

OR :  have the mouseListener call 

your own start and stop methods which causes this thread to stop and start
by calling Thread.wait() and notifyAll() ( mind you these have to a lock of
some object or else the complier will complain...). Slight tricky here so be
slightly careful in implementation

Thanks and Regards,
Gary Grewal



-----Original Message-----
From: D. Michael Nelson
To: [EMAIL PROTECTED]
Sent: 6/20/01 12:19 PM
Subject: Animation Thread?

Hello,

I have created a thread that runs an animation.   I want to add two
JButtons
to the application that will start and pause the animation thread.  I am
uncertain how to pause the animation thread or resume it?  Any ideas?

Thanks In Advance,
D. Michael Nelson


_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to