Refactoring of background image feature

Moved code out of paintComponent method and made the background image to be cleared when the cancel button is clicked.