How to erase a graphic object on JPanel.
Posted on 2000-03-16
I have a drawingpanel which extends from JPanel. I am trying to move objects on it. When I draw a circle and move it(draw it on a different place), I am unable to erase the last one I draw. I am using setColor(Color.white) and fillRect(..) to erase the previous drawing, but when I run my program I get all the drawings of the circle on the screen. How can I erase the panel before I draw a circle in a new position?