Building a project and I have stuck on a part now, where when user press a button, the interface starting from it's first status and each 1 sec. moving to the next, until reach the current. Imagine something replay with chess. Replay the movements that made so far. So I have these lines...
synchronized(model){
for(int i=0; i<model.userStates.size(); i++){
try {
Thread.sleep(1000);
model.currentState = model.userStates.get(i);
model.notify();
}
catch (InterruptedException e1) {}
}
}
My problem is that when press the button, remain pressed (no update on interface) and at the end released. Tried constant number in get(), ex '0' and with 4 elements in the list, after 4 sec. the interface change to very first status (0). What I'm doing wrong, or what need to change?Thank you


Sign In
Create Account


Back to top









