Solution:
When a window is repainted by the AWT painting thread, it sets the clipping regions to the area of the window that requires repainting.
Credit: 3870