the method 'paintComponent' is added
small changes in the method main are added