JavaFX doesn't show a dialog box like it is supposed to when the window close is called from a thread.
import javafx.application.Application;
import javafx.concurrent.Task;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class Main extends Application
{
    public static void main(String[] args)
    {
        launch(args);
    }
    @Override
    public void start(Stage stage) throws Exception
    {
        Task<Void> task = new Task<Void>()
        {
            @Override
            public Void call() {
                VBox vBox = new VBox();
                vBox.getChildren().add(new Label("Label"));
                stage.setScene(new Scene(vBox));
                return null;
            }
        };
        new Thread(task).start();
        stage.show();
//      VBox vBox = new VBox();
//      vBox.getChildren().add(new Label("Label"));
//      stage.setScene(new Scene(vBox));
    }
}
When I run the code, I only see a black window. If I comment out the code, I see a window that says "Label".
In my actual application, I want the scene to change depending on user input to the other thread.
If I cannot call JavaFX functions from another thread, how should I do this?
 
    