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

Mac: DragEvent.getDragboard().getFiles() returns an empty list with FX 8

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 8
    • Fix Version/s: 8
    • Component/s: javafx
    • Labels:
    • Environment:

      MacOS 10.8.2
      JDK 8 b65

      Description

      Attached code does:

              scene.addEventHandler(DragEvent.DRAG_ENTERED, new EventHandler<DragEvent>() {
                  @Override
                  public void handle(DragEvent dragEvent) {
                      Dragboard db = dragEvent.getDragboard();
                      final List<File> files = db.getFiles();
                      if (!files.isEmpty()) {
                          try {
                              final File file = files.get(0);
                              System.out.println("File: " + file.getAbsolutePath());
                              System.out.println("File exists: " + file.exists());
                          } catch (RuntimeException e) {}
                      } else {
                          System.out.println("Empty list of files !");
                      }
                      dragEvent.consume();
                  }
              });

      I start the program from a terminal, then I select in Finder a file and hover my FX scene to enter the event handler.
      When running it with Java 7 U10 (or Java 7 U12) I enter the if case, Dragboard.getFiles().get(0) returns the file name I used for hovering.
      When running it with Java 8 b65 I go to the else branch "Empty list of files !".
      Did I miss something ?

      I didn't give it a try on Windows nor Linux.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                anthony Anthony Petrov (Inactive)
                Reporter:
                yjoan Yves Joan (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: