Hey I want to simulate a knight moving in my Knight Tour Gui,

this is the display code, the moves are stored in the arraylist moves.

public void display()
	{
		for(int i = 0; i < moves.size(); i++)
		{
			//Gets the correct button
			JButton button = square.get(moves.indexOf(i+1));
			
			button.setText("" + i);
		}
	}

I had something like this, but wasnt implementing the timer correctly I think because it didnt work.

Any help on this or other ways to do it

public void display()
	{
		timer = new Timer(2000, new ActionListener() {
		    public void actionPerformed(ActionEvent evt) {
		    	
		    }});
		for(int i = 0; i < moves.size(); i++)
		{
			//Gets the correct button
			JButton button = square.get(moves.indexOf(i+1));
			
			timer.setDelay(1500);
			
			button.setText("" + i);
		}
	}

you mentioned making it sleep

you will need import java.lang.Thread.*;


and

Thread.sleep(1000);

put in the program at any line, will make it sleep 1 second or 1000 milliseconds. The program tells the operating system, i'm done for now, come back to me in 1000 ms.

Mike