0

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.

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by BestJewSinceJC
0

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.

0

thank you. the super.paintComponent method worked

0

Yep, no problem. Somebody else on this forum told me that solution a while back as well. Also, mark this thread as solved

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.