My background is drawn in the resize method and never repainted unnecessarily. It is the sliders and buttons that are repainted unnecessarily. Perhaps I am misunderstanding your comment?
Sorry, was only an addition to @Rail_Jon_Rogut’s suggestion for creating the background into an image. He didn’t say where to call his createNewBackground() method. There are two ways,
if (getWidth() != m_Background.getWidth() || getHeight() != m_Background.getHeight())
because resized is only called when the bounds (probably) changed, you don’t need that check, if the size changed…
That was all, nothing important really
Edit: Checking the context again, completely my bad… sorry… you were talking about sliders, it belongs rather to the meters thread! Best ignore me
I see, sorry about that!
Just for clarification… My example is showing using the methodology for the background… This same approach can be used for any graphic element to reduce redrawing the same thing unnecessarily.
In my example case the createNewBackground() is actually called from when a new groove variation is selected and if the length of the groove is different to the previously loaded variation – it can actually be seen in use in the video I posted above around 0:12.