Thread.sleep() behaves weird in Listeners
Hey,
I am a rookie in Swing and I am writing a small game. The game is a two player game. I am now trying to add AI to the game so when the human player clicks on the board he plays and then the computer plays its turn.
So in pseudo code:
//in action listener
human.play
robot.proceed
sleep(3000)
reprint the board
robot.proceed
sleep(3000)
reprint the board
robot.proceed
sleep(3000)
reprint the board
where proceed is a method that makes the robot play on three stages...
So basically I am trying to simulate the actual way a human plays...
The problem is that when the human player clicks the game hangs for all 9 seconds then suddenly the board is reprinted with both moves...
How can I overcome this problem?
Thank you

