First of all, you can only paint on a Canvas object.Secondly if you did have a canvas object, you musthave a public void paint(Graphics g) instead of publicvoid paintComponent ( Graphics g ).