Calling
Platform.runLater(new Runnable(){
// do your GUI stuff here
});
will fix it.
This happened with me when i was modifying UI element from task in javafx 2 like listview elements.A Task Which Modifies The Scene Graph helped me to solve the issue i.e. updating UI elements by
final ListView
Task
@Override protected Void call() throws Exception {
group.getItems().clear();
for (int i=0; i<100; i++) { Platform.runLater(new Runnable() { @Override public void run() { group.getItems.add(i); } }); } return null; } };