我試圖讓 FXML 標(biāo)簽在特定的時間間隔內(nèi)自行刷新,但我在下面顯示了一個異常。我在這里的嘗試: public static void showActualViewer(MixerChannel mixerChannel, Label label){ Platform.runLater(new Runnable() { @Override public void run() { Timer timer = new Timer(1000, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { label.setText("Actual Viewers : " + mixerChannel.viewersCurrent); System.out.println("works"); } }); timer.start(); } }); }錯誤:線程“AWT-EventQueue-0”中的異常 java.lang.IllegalStateException:不在 FX 應(yīng)用程序線程上;currentThread = AWT-EventQueue-0
如何使用 javafx 執(zhí)行 Timer 類,其中 javafx 對象在內(nèi)部發(fā)生變化
慕尼黑5688855
2023-05-17 16:10:21