Animation doesn't show when used as action?
I have this little input animation, basically just a pause between value changes, it shows nicely when I just place it in the main arguments.
But when I try attaching it to a button, the program just freezes for the amount of time it takes to "input" and then it just shows the final product.
Can I fix this? Do you guys need some example code?
Code:
public void solve(){
for (int a = 0; a < 9; a++){
for (int b = 0; b < 9; b++){
try {
Thread.sleep(10);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Grid[a][b].setText(String.valueOf(answer[a][b]));
}
}
}
it just replaces button names, it works when I simply call the method, but when it's in:
Code:
final JMenuItem solve = new JMenuItem("Solve");
solve.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
solve();
JOptionPane.showMessageDialog(null, "WIN!!...wait...");
}
});
When I have sleep set as 10, it waits a bit, then shows everything, set as 100, then waits 10 times as long.
can anyone help?