cmq ho fatto qualche prova:
funziona tutto tranne la riga commentata, che si occupa di fare il refresh della TableView.codice:private void updateBooks() { try { BackgroundTask bt = new BackgroundTask(); Task<Void> task = new Task<Void>() { @Override public Void call() throws InterruptedException { try { jsb.launchService("all_books"); jsb.launchService("all_authors"); jsb.launchService("all_editors"); jsb.launchService("graph_authors"); jsb.launchService("graph_editors"); jsb.download(UrlAndPath.JSON_LIBRI); jsb.download(UrlAndPath.JSON_AUTORI); jsb.download(UrlAndPath.JSON_EDITORI); //setTable(); } catch (IOException e) { GenericDialog.showDialog(e.getMessage(), Alert.AlertType.ERROR); } return null; } }; bt.execTask(task); } catch (InterruptedException e) { } }
se non commentata ottengo questo errore:
codice:Exception in thread "Thread-4" java.lang.IllegalStateException: Not on FX application thread; currentThread = Thread-4

Rispondi quotando