Slow UI, how do I use setBufferedToImage effectively?


#1

I have some components which I animate moving around and scaling but contents never change. They have a lot of text, vector graphics, and other things and they render slow as mud. When I set `setBufferedToImage(true)` the performance increases greatly when the components are not moving, but as soon as I start to move/scale them it triggers a repaint, and I go down to 2fps again.

Is there a way to set it so scaling a whole component won't result in a repaint? What is the right way to handle this?


#2

That's what you'd expect - whenever the component changes size, it'll need to refresh its buffered image.

You could roll your own cached image and scale it? Or it might be possible to do something clever involving a custom subclass of CachedComponentImage.