use paintComponent instead of paint