-
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)
Thanks
-
Code?
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:
The problem is that when I call the repaint method in the method that creates the new component...
I don't understand it
eschew obfuscation
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks