java - JavaFX: Task will not update UI -
I am working on the Omaha Online Poker client written in javaFX + java.
I need it control.call () After the execution is over, show an anchorpan with 3 buttons. I know that execution of control.call () ends but for some reason
task.setOnSceeded (new event handler) { 's handle method not Update User Interface
What am I doing?
Public Zero Neuround () {sog = StateOfGame.PREFLOP; ControlGameOnNewThread control = new ControlGameOnNewThread (); Task Task = New Action () {@Override protected Object call ()) Exception {control.call (); Return tap;}}; Work .Setonux (new event handler) {@Override Public Zero Handle (event event) {if (client.getAction () == FirstToact.me} {System.out.println ("Task Finished"); Showpans (clients .getToCall ()); Rival BETField.setText (new integer (opp.chipsInvested) .toString ()); MyBetField.setText (new integer (client.chipsInvested) .toString ()); System.out.println ("Task Finished");}}}); New thread (task) .start ();}
The problem is that you are updating If you are in another thread and you want to update the user interface,
you need to call
in the other thread. I Platform.RunLater (New Runnabal) {@Override Public Zero Run () {// Update UI Here}}); This call will call the main thread and update all the necessary updates in the user interface
edit
Public Zero Neuround () {sog = StateOfGame.PREFLOP; ControlGameOnNewThread Control = New ControlGameOnNewThread (); Task Function = New Work () {@Override Secure Object Call ()) Exception {control.call (); Return tap; }}; Task.setOnSceeded (New EventHandler) {@Override Public Nil Handle (Event Event) {If (client.getAction () == FirstTit.I) {Platform.RunLater (New Runnabel) {@Override Public Zero Run ({{System. Out.println ("Task Finished"); Showopresses (client.txt ()); Rival BETField.setText (new integer (opp.chipsInvested) .toString ()); myBetField.setText (new integer (client.chipsInvested) ToString ()); System.out.println ("Finished Work");}})}}}}); New thread (task). Start (); }
Comments
Post a Comment