java - using task worker in javaFX to do background task always -


i have background thread in javafx according objects fields change return object , should update ui according new object . , need repeat . unfortunately repeats 1 time! don't understand why . mean output : "id" (just 1 time!)

 task<category> n = new task<category>() {          @override         protected category call() throws exception {             final int catnum = iterateallcat.size();               while (true) {                  boolean catdone = false;                 system.err.println("id");                  (int = catnum - 1; >= 0; i--) {                     final category cat = iterateallcat.get(i);                         if (cat.done) {                             break;                         }                         catdone = true;                      if (catdone) {                         system.err.println("done");                         break;                     }                 }                 return category;             }         }      };     n.valueproperty().addlistener(new changelistener<category>() {         @override         public void changed(observablevalue<? extends category> observable, category oldvalue, category newvalue         ) {             try {                 board.categorypane(++num);             } catch (nullpointerexception n) {              }         }      }     );         thread t = new thread(n);     t.setdaemon(true);     t.start(); 


Comments