David and Ted:  You might also check out the Timing Framework project
on java.net (http://timingframework.dev.java.net); I wrote this as
an example of using timers (see the associated article as well), but
also as a utility layer on top of the existing Timer facilities.
I hope to add more functionality to it as I get time, but in
the meantime I find it a bit easier to use that the Swing timer
for the kinds of stuff I do.  (for example: it calls your
callback function with a float fraction that represents the
amount of the duration that's expired, and it lets you set
a total duration after which it automatically stops).

Rob: I'm talking about this very subject
(animating Swing components) in the "Advanced 2D" session
at JavaOne, so c'mon by if you're at the show.  Also, come by
the "Ask the Experts" forum on Monday evening (630-800) and
the 2D and Swing BOFs on Tuesday nights; other good places to
pick our brains on this and other subjects...

Chet.


David Kavanagh wrote:
I agree that the swing timer seems like the better approach. I never
really looked at that before. I just had a look at the documentation and
source code and it seems like it ends up doing the same thing I was
which is submitting user code to run on the event thread at predefined
intervals. Whlie I'm not sure it will help my code run better, I'm sure
it will make my code look nicer because it handles things that I coded
explicitly. I'll give it a try when I get time to play with this again.
Thanks
David

Thus Spoke Ted Hill:

Instead of using invokeAndWait from a background thread, I think using a
Swing Timer would be a better choice.

See:

http://java.sun.com/docs/books/tutorial/uiswing/misc/timer.html


-----Original Message-----
From: Discussion list for Java 2D API
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".


===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to