interruptions

Java, replacement for infinite loops?

拟墨画扇 提交于 2019-12-01 04:37:33
I am making a program that shows cellular growth through an array. I have gotten it so when I press the start button, the array updates every 10 seconds in a while(true){} loop. The problem with that is I want to be able to stop the loop by pressing the pause button, but while in the loop, it wont let me use any of the controls. I need something other than a infinite loop in orer to refresh the frames. I am a bit of a newbie, but I am in a java class at the moment. so I have some grasp of the language. OscarRyz What you need is use a Timer which changes the state of your component ( in this

Java, replacement for infinite loops?

五迷三道 提交于 2019-12-01 02:16:43
问题 I am making a program that shows cellular growth through an array. I have gotten it so when I press the start button, the array updates every 10 seconds in a while(true){} loop. The problem with that is I want to be able to stop the loop by pressing the pause button, but while in the loop, it wont let me use any of the controls. I need something other than a infinite loop in orer to refresh the frames. I am a bit of a newbie, but I am in a java class at the moment. so I have some grasp of the