Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8092561

[Dialog] Dialog can not be closed from event handler of a task

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • 8u40
    • 8u40
    • javafx
    • None
    • win7 x86

      I am working on an extension of Dialog which shows the progress of a Task and provides a ui to cancel the task. I am working with the new Dialog API in 8u40. The Task is started, when the dialog is shown. Displaying the progress works great. The dialog returns the result of the task when done.

      I am having a problem closing the dialog, when the user cancels the task. I am trying to do this by

      task.setOnCancelled(event -> {
          dialog.close(); // or dialog.setResult(null);
      });

      Unfortunately, this does not close the dialog as expected. Wrapping the close() in a Platform.runLater also doesn’t help.

      To reproduce:
      - Run CancelableTaskDialogTest (see comments)
      - Press "Start long running task"
      - Press Cancel

            jgiles Jonathan Giles
            ckeimeljfx Christoph Keimel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: