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);
}
}