包
timer.setText()起来
Platform.runLater()。在它的外面,在while循环中,添加Thread.sleep(1000);
非法状态异常的原因是你试图在JavaFX Application线程以外的其他线程上更新UI。
添加应用程序时崩溃的原因是,通过无限期添加要在UI线程上执行的进程,UI线程过载。使线程hibernate1000ms将有助于你解决此问题。
如果可能,用Timer或TimerTask替换while(true)。

包
timer.setText()起来
Platform.runLater()。在它的外面,在while循环中,添加Thread.sleep(1000);
非法状态异常的原因是你试图在JavaFX Application线程以外的其他线程上更新UI。
添加应用程序时崩溃的原因是,通过无限期添加要在UI线程上执行的进程,UI线程过载。使线程hibernate1000ms将有助于你解决此问题。
如果可能,用Timer或TimerTask替换while(true)。