reapinting without losing old paints
I am trying to create a new component at a different location to the old one on the same frame.
The problem is that when I call the repaint method in the method that creates the new component, I lose the old one. it disappears.
Is there any way to keep both of these components. I only want to create the new component when a button is clicked, so I need to somehow put everything in a new method.
I also want to be able to do this a number of times (with an increasing value so that is paints further down each time the button is clicked)
Are these custom components?
I think this solution will work... Every class that extends Object (which I believe every class does by default), you will take all the methods of Object. One of these methods is this:
protected Object clone();
This will give you an exact copy (clone) of that object without deleting the orrigional one.
Hope this helps.
If that happends you are either recreating the new component using the previous
components variable name, or your paint job is set up to paint only one instance of
the component. If you keep on creating new components you should store them
in an ArrayList that is looped and drawn in the paint job.
However, this puzzles me:
I don't understand it
The problem is that when I call the repaint method in the method that creates the new component...
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center