Course Links

Exercises

Resources

External

Animation Notes

If you wish to have the program display its progress towards solution as it works, you may need to tell the window to repaint() itself. Normally, Java Swing will wait until the function triggered by an event listener (such as that attached to the Solve button) has completed before calling repaint(). Therefore you will need to insert extra calls to the function if you want to display results in the middle. You may also wish to delay slightly so you can see what is happening. The following code fragment, when used inside a Maze method, figures out what frame the Maze is stored in and tells it to repaint() itself, then sleeps for 25 ms.

        repaint();
	try {
	    Thread.sleep(25);
	} catch (InterruptedException ignore) {
	}