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
[mailto:[EMAIL PROTECTED] On Behalf Of David Kavanagh
Sent: Friday, June 10, 2005 8:05 AM
To: [EMAIL PROTECTED]
Subject: Re: [JAVA2D] animating Swing components


This is a good topic. I tried this last year with a text field. I wanted
to have a marquee style widget for displaying text that is longer than
the box provided. I ran a background  thread that simply updated the
text displayed at some preset intervals. (yes, I used invokeAndWait()
from the background thread) I ran into problems with the UI not updating
smoothly and I thought I had to much CPU being used. I even had my
background thread sleeping for over 1/2 second between updates. I never
spent much time debugging, so I'm nut sure what the right answer is.

David

Thus Spoke Rob Ross:

> Hi.
>
> This is (mostly) off-topic, but maybe someone can point me to the 
> proper place to ask this.
>
> I am comfortable creating animations in general by using Java 2D 
> drawing and background threads.
>
> I'm not sure how to apply some of these concepts when using Swing 
> components, however.
>
> One thing I'd like to animate is a JSplitPane, so when a user clicks a

> button or chooses a menu item, the JSplitPane will be adjust to some 
> certain size, but I don't want to just "jump" to the new size. I want 
> to see the JSplitPane scroll in real-time to its final size.
>
> There are other such animations I'd like to do, like scrolling a 
> JTable or JTree to some specific position, while showing all the 
> intermediate scroll positions to the user.
>
> Any pointers?
>
> Thanks,
>
>
> Rob Ross, Senior Software Engineer
> E! Networks
> [EMAIL PROTECTED]
> ---------------------------------------------------
> "Beware of he who would deny you access to information, for in his 
> heart he dreams himself your master." -- Commissioner Pravin Lal
>
> ======================================================================
> =====
>
> 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".

===========================================================================
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