posted 20 years ago
I have been working on a component that uses a custom paintComponent() function that is rather complex. It can take upwards of a tenth of a second under fairly normal circumstances, and for that reason, I only call repaint() when I absolutely need to. (Meaning the display would actually change), but I have now added "drag selection" functionality to my component, and the constant repaint() calls in order to update the rectangle are making the program very very choppy.
Is there a way to calculate the "background" image when necessary, and then just repaint it like a normal image without the tons of processing required in my current paintComponent() function, to allow for a non-choppy display of a selection rectangle?
If anyone has done this, I would love to see some example code. I tried to find a decent way of accomplishing this, but could not come up with one.
Thanks for the help.
--Sky.