Modify resizing listener to prevent concurrent repainting causing graphical corruption