So when the button is pressed, have the code above execute, and have the above code call tryMaze? Then where do I put the timer and stuff?
Yes, just that, you don't need the timers etc, this should be sufficient (assuming I typed it ok!). Now, when your method does its sleep(...) the Java Swing thread will be able to run and process window updates.
Oops- I did miss-type, missed the line with the Thread! This should be better
new Thread(
new Runnable() {
public void run() {
// call your tryMaze here
}
}
).start();