Java, replacement for infinite loops?

前端 未结 9 733
花落未央
花落未央 2021-01-13 00:45

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){} l

9条回答
  •  不思量自难忘°
    2021-01-13 01:20

    If those "buttons" are Swing buttons, then the way to do this is: have the Start button create a new javax.swing.Timer object which does the update every 10 seconds. Then have the Pause button stop that timer.

提交回复
热议问题