I have a menu item of a context menu with the following code:
MenuItem mi1=new MenuItem("to hand");
mi1.setOnAction(e->{
list.remove(card);
arena.getHand().addCard(card);
updateSlots();
shuffle();
});
the shuffle method creates a new thread and run most of the code in this new thread; the other functions (addCard and updateSlots) run in the main thread;
from this code, I would expect the function shuffle to be run only after the updateSlots function has completed;
but it doesn’t appear to be the case; unless I’m missing something, the shuffle method is being called before the updateSlots even finish;
how can this be? am I missing something?
1