public class Graphics2DTest extends JPanel implements ActionListener{ private Timer time = new Timer(5,(ActionListener) this); int x = 0,y = 0; public void paintComp
You need to repaint the background each time as well. Add code to paint the background before you paint the rectangle.