- First, I add super.paint(g) in my own paint method.
When it repaints, things drawn before are cleared.
Sorry, I can't have the reputation to post more than 2 links.
Then, I remove super.paint(g) in my own paint method.
You can see things drawn on the Panel before are still there.
When you add super.paint(g), in your method it will call the method in the superclass of this subclass.My class RussiaPanel extends JPanel, and JPanel extends JComponent. It will invoke the "public void paint(Graphic g)" method in JComponet, and the things on the Panel will be cleared.For more details, you can refer to the API docs.
Hope to help you, and forgive my poor English.