can you guys help me how can I remove all those drawn rectangles if user click the mouse in the applet field?
I am supposed to write a program that displays a rectangle and color it with green when user drag the mouse. But if user click the mouse anywhere in the field then that rectangle should disappear.
I have got all working except that mouse clicked part.
Here is my code
I spent 2-3 hours helping you, the least you can do is mark the thread as 'solved'. I also gave you a suggestion on how to do this in the other thread, although I don't think my suggestion was a good way to do it. But if you make the rectangle have no area, then when it is repainted, it will display as invisible.
^^ No, I was talking about marking that thread as solved, which is your previous thread. Its a matter of courtesy to mark a thread as solved, especially when someone spends a lot of their time helping you, as I have.
Anyway, the way that you make a rectangle with no area is easy. Area = length * width, so a rectangle with either length = 0 or width = 0 will have 0 area. So set one of the sides of the rectangle to 0. Again, I direct you to the Javadoc:
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.