How can I paint an oval or a rectangle on a panel with a certain amount of time lag?
I have made a program that lets you draw a graph on a panel, using MouseListener methods. And now i have to simulate a Breadth First Search Search on that graph. By changing the color of the nodes as i traverse the graph. One node at a time. Suppose i have 3 nodes say 1,2,3. and My BFS says that I have to traverse from 2,3,1. So i want 2's color to change first then 3's color and then 1's but there has to be a significant time delay between the color changing of the nodes. If i use a normal loop and paint the nodes in my paintcomponent method all the nodes are colored at the same time. :/
Any ideas, how to do this?
Re: How can I paint an oval or a rectangle on a panel with a certain amount of time l
Use a timer method that changes the data to be drawn and calls repaint() for the paintComponent() to draw the new stuff.