hey
i need help. ive been trying to put a timer in a for loop, but it doesnt seem to work. need help. thanx.
i want the data printed in every array to be delayed by a few seconds
heres the code
i need help. ive been trying to put a timer in a for loop, but it doesnt seem to work. need help. thanx.
i want the data printed in every array to be delayed by a few seconds
heres the code
Code:
class ButtonListener implements ActionListener
{
private static final int TIMER_DELAY = 2000;
protected static final int COUNT_MAX = 160;
protected static final int DELTA = 1;
public void actionPerformed(ActionEvent arg0)
{
InsertionSort(numbers);
new javax.swing.Timer(TIMER_DELAY, new ActionListener()
{
public void actionPerformed(ActionEvent arg0)
{
for(int i=0;i<5;i++)
{
for(int j=0;j<5;j++)
{
System.out.print(sortedArray[i][j]+ "\t");
}
//move to new line
System.out.print("\n");
}
}
}
).start();
}
}
Comment