I'm in need of help again and back to Javaranch ("forgotten password" doesn't seem to work:/), so hello all, again!
I'm implementing Conway's Game of life, in
java. It works, and I'm at the stage of trying to make a simple interface to allow control of the speed, grid size etc. The first control that I created is the start/stop button and I'm having trouble with starting and stopping the simulation.
This is my method that calls each step of the game:
This works just fine as soon as the program is run. It works with different settings well. The problem arises when I try to pause the whole thing. If i set the stop boolean to true, then false and call start() again, the gui gets stuck at the paused state and becomes unresponsive (I need to force quit). All that the gui.update() does, is call the Graphic component's repaint() method.
Note that the simulation still runs well, except for the GUI. grid.update() calculates the next step correctly and on time, and this is reflected when grid.print() prints the output in the commandline correctly (in the meantime the gui gets stuck).
I think I've supplied with enough info, I'm more than eager to supply more if needed!