Update more than one label from task


Update more than one label from task



I have a class (task) that update a label with


this.updateMessage("Hello World!").



Now I need to be able to update another one.
If I use updateMessage only the first is updated.
how can do it?



I post my code.



-this is MainController:


//this is first label and it works
firstLabel.textProperty().unbind();
firstLabel.textProperty().bind(myClassTask.messageProperty());

//this is secondo label and it not works? why? how can do it??
secondLabel.textProperty().unbind();
secondLabel.textProperty().bind(myClassTask.messageProperty());

myClassTask.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
@Override
public void handle(WorkerStateEvent e) {
myClassTask.chiudiBrowser();
myClassTask.cancel();
}
});
runningRaffle.setOnCancelled(new EventHandler<WorkerStateEvent>() {
@Override
public void handle(WorkerStateEvent e) {
myClassTask.chiudiBrowser();
myClassTask.cancel();
}
});
Thread thread = new Thread(myClassTask);
thread.setDaemon(true);
thread.start();



this is myClassTask


public class myClassTask extends Task<Void>{

public myClassTask(Properties p,Properties p2){
}

@Override
protected Void call() throws Exception {
StartRunning();
return null;
}
private void StartRunning() {
try{
// make something
...
//this update the first label
this.updateMessage("Hello World!");
// for update the secondLabel????....
}catch(Exception e){
e.printStackTrace();
}





You need to give us more codes so that we know what you are doing here.
– Jai
Jun 29 at 9:25





Your question is not clear and doesn't have enough details. Please show your code so that you may get suitable answers if any. Please read through the FAQ and How to Ask section in the site.
– Sid
Jun 29 at 9:25









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

Opening a url is failing in Swift

Export result set on Dbeaver to CSV