I’ll try to explain my dilemma with a bit more detail.
I have 10 instances of the same component on the screen, sometimes animated individually and sometimes all at once. Their speed is always the same so only one timer is needed. ~30 fps is fine but anything lower will look choppy and undesirable.
My drawing code is pretty complex, with lots of calls to drawImage, drawText, fillEllipse, and addArc/strokePath. I’ve optimized this code to my best ability by drawing to bitmap buffers first, and only updating those bitmaps when required. My paint() method just draws the bitmaps layered on top of each other. This is already very efficient, I can even bump the frame rate up to 60 without performance loss, but repaint() does not always fire an actual re-paint so it stutters from time to time.
I tried using AnimatedAppComponent but it was extremely slow in comparison, because I was using a single timer to handle all 10 components instead of individual timers for each one. Besides after glancing at the source code for AnimatedAppComponent I realized its using the exact same approach, just a Timer that calls repaint() periodically. The only difference is I was using a HighResolutionTimer.
I even tried using OpenGLAppComponent to work around this issue, but it has its downfalls too. Mainly because drawing to a texture and then rendering the texture is less efficient than drawing directly to the screen, bitmap buffers work just as well. I didn’t have this stuttering issue with OpenGL but I’d rather not use it if I don’t need to.