views:

103

answers:

1

My JavaFX app's UI freezes after consecutive times of executing webservice calls. Those process calls are asynchronous.

How do I fix this problem? Is there a way to "unfreeze" the UI?

Sorry for the newbie question. But I badly need anyone;'s help

+1  A: 

Did you create a thread to execute it? JavaFX is executed on the EDT (event dispatch thread). That is why you experience GUI freeze. Here is what you do

import javafx.async.*
public class MyWebService extends RunnableFuture {
   public var webserviceURL:String;
   override run(): Void {
     // your web service
   }
}
public class MyWebServiceTask extends JavaTaskBase {
   override create(): RunnableFuture {
      return MyWebService {
         webserviceURL: "http://...."
      };
   }
}

def webserviceTask: MyWebServiceTask = MyWebServiceTask { }
webserviceTask.start();
Chuk Lee
My UI is in JavaFX while the webservice client and other classes are in JavaME. To answer your question, a thread was created in Java to execute it. Do I still have to use the code you posted above?
cancelledout
You thread should implement RunnableFuture in Java. The start it with MyWebServiceTask in FX.
Chuk Lee