Hi Guys, I had made onr Applet on which u can draw geometric figures like line, circle etc., . My problem is that whenever I perform some window actions my applet get refreshed and all the things that I had drawn on it got lost . My applet again become blank. I want to know that how I can store these figures in Vector or some other Collection framework so that in case of any window application I retrive them. If any other methos u feel is quite good enough to retrive them , please suggest to me. Bye
Here's a technique of drawing a shape while dragging and adding it to an ArrayList from which it can be retrieved for drawing.
All the shape creation and manipulation is in the event code. The paint code simply draws it.
If you were to create a data store (fancy term for a separate class to store some data) class to add state to your shapes, eg, color, isSelected, selection color, fill color, stroke, you could add a new instance of it to the ArrayList and retrieve the instance variables from it during painting.