Or, instead of using add/remove notify, have your component listen to itself for component and/or hierarchy events to determine whether it's visible, added to a viable component hierarchy, etc. You could choose to stop the animation when not visible (or at least not try to paint), disabled, etc.
Joel -----Original Message----- From: Paul Brinkley [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 25, 2001 12:41 PM To: [EMAIL PROTECTED] Subject: Re: Animation component: when to quit? At 07:40 PM 10/25/2001 +0200, Alex Bitney wrote: >Hi! > >Paul Brinkley wrote: > > > > I wrote a class that represents an animated image. (Yes, I know, it's been > > done elsewhere; mine has extra features, blah blah blah...) The image is > > > > > The problem is in making it stop properly. When animating, it runs in its > > own Thread. (I should probably use the Timer thread instead, but that's > >Override Component.removeNotify() method. Works always. Ah, I see. So I define it like: public void removeNotify() { super.removeNotify(); // set a flag or whatever to stop the thread or stop making timer events } Right? Looks good to me. _______________________________________________ Advanced-swing mailing list [EMAIL PROTECTED] http://eos.dk/mailman/listinfo/advanced-swing _______________________________________________ Advanced-swing mailing list [EMAIL PROTECTED] http://eos.dk/mailman/listinfo/advanced-swing