I got a requirement of a Loading images in a JPanel components.
Consider the JPanel has 10 components and all those components needed to be set with a Background image.
So in the paint method I implemented the background image setting logic but that is very slow.
I wanted to achieve the same task but with efficient way.
The Component’s paint method is invoked every time you move, drag, resize, … your window and in several other situations. Therefore only use the paint method for (re)painting your component and invoke the loading process only once.
Create small thumbnails of your images, and cache them in some kind of class, for example: