Updated repaint behavior of the panel to avoid consuming all resources