i am doing animation using applet.I finished some work.
Now i am drawing some image. i want it auto. if i press a button that image should be draw 5 times in row. 1 after 1. on applet after some time delay.
like train - after drawing 1st image after some time same image append to first one.
i used thread also time thread. but its not working.
That is certainly possible, but you haven't provided enough information to tell what is going on. Posting a short, relevant excerpt from the code would help, as would a more detailed description of what is happening.
The solution involves implementing the Runnable interface, and then starting a thread with that Runnable. Within that thread's "run" method you would set up all variables the paint method needs for painting, and then call "repaint" at each iteration.
I am showing the auto animation of linked list.
In above code using node method i am drawing image which showing a one node of list.
Now i want to show animation for 5 node in list. Like after one node we are adding another node.
but In above working code inside for loop if i am calling node method that node image is just moving forward.
Sorry, I don't understand what "showing a one node of list" means, and consequently also not how "show animation for 5 node in list. Like after one node we are adding another node. " would look like. What are "nodes" - text? images? something else? What do "nodes" look like on the screen? How would several of them look like?
OK, now we're making progress. You need to write the paint method in such a way that it draws the correct things no matter when it's being called. In other words, it needs to be able to read all state that is needed for drawing from some instance variables.
One approach would be to have an instance field (maybe "count") that is counted up in step with the loop variable in the "run" method. The run method would then simply increment "count", call repaint, and sleep. The paint method would look at "count", and then draw an appropriate number of nodes.
Edit: Just saw that you tried to post an image - you're better off using a format that can be viewed in a browser (gif, png, jpeg), and make sure it's small in size and dimensions.
You need a loop somewhere that iterates over all nodes, and decides which one to draw -and which one not to draw- based on value of the counter. The actual coordinates of each node should not depend on the value of the counter.