Hi, all! I've got a new and fun problem to discuss with you. So, I'm using
the FadeTransition to fade a label. Concurrently, I'm sometimes using a
custom decorator to blink an image. (Come to think of it, maybe a
Transition would technically be more appropriate for blinking than a
Decorator, but whatever...) The fade lasts about two seconds, and the
blinking five seconds (when it happens).

I've noticed a few things, on my Macbook Pro i7 2.7GHz with 8GB and
otherwise low CPU load...

   - I've got the FadeTransition set to 10Hz, but the fade calls hit at
   around once per 300ms with 100% CPU utilization
   - If I comment-out the Label.repaint() method, the fade calls hit every
   100ms, as intended (but no fading happens, of course)
   - The image blinking is configured for 2Hz, but during the fade, the
   blinks are irregular due to high CPU load. When the fading stops, the
   blinks become regular. This is my biggest issue, since it looks really bad.

I'm considering trying something advanced, like passing the Label.repaint()
call to an Executor so it doesn't block, and then the blink callback can
hit in a timely manner. But I'm reading Java Concurrency in Action, chapter
9 ("GUI Applications"), and it talks about how most GUI
frameworks (including Swing... which Pivot sits on, right?) are already
single-threaded, and for a reason. I'm going to try the Executor and see
how it works, though I'm guessing I'll just be shifting the issue from one
thread to another, but I have to try something. In the mean time, I'm
curious to hear if you have advice regarding this slow redraw issue I'm
seeing that is causing the blocking. Maybe there is a non-blocking
Component.redraw() I don't know about... =)

Thanks in advance for your time!

Cheers,
--E

Reply via email to