i have written a program in which i am drawing using a mouse. however while drawing a new line the previous ones are still being shown. i have called repaint every time the mouse is moved.
Can anyone please help.
At the start of the paint method, call super.paintComponent. This should have the effect of clearing the screen. If it doesn't, draw a new rectangle on the screen that is the color you want (white or gray probably) that fills the whole screen.