'paint()-mehod faster while mouse is moved

I am currently working on a private project that uses a normal java JFrame, in which I paint an image (in form of an int[][] with ARGB-values). Then I plot this image pixel by pixel inside the paint()-method. I have to do this, because I want to shift/zoom the image to my liking. When I enlarge the window to my screen size (2560*1600) one run takes about 10 secs. Doing the same whilst just moving the mouse around this time decreases to ca. 1.5 secs. Has anyone an explanation for this 7-time boost? Thanks! Bike



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source