JAVAFX - UI-UNRESPONSIVE FOR LONG RUNNING PROCESS

Scene is not a thread safe and can only be accessed and modified from the UI thread also known as the JavaFX Application thread.

Long-running tasks on the JavaFX Application thread makes an application UI unresponsive.

The Java platform provides a complete set of concurrency libraries available through the java.util.concurrent package.

. The javafx.concurrent package consists of the Worker interface and two basic classes, Task and Service, both of which implement the Worker interface.

. Solution : 
Create task and write logic in it .

  Task<Void> task = new Task<Void>() {
            public Void call() {
// write your logic here
              return null;
            }
          };
          task.setOnSucceeded(event -> {
          });

Comments

Popular posts from this blog

Filter In Javafx

Kotlin with StandAlone Complier