<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
Hello,
<p>I'm using macOS Sonoma 14.3 aarch64 and I'm trying to recognize
whether a file was successfully dropped into finder from the
JavaFX application. However, the event always reports that it was
not accepted. I was under the impression that event.isAccepted()
should return true if it was successfully dropped. This is the
reproducer:<br>
</p>
<p><code>public class DragDrop extends Application {<br>
@Override<br>
public void start(Stage primaryStage) throws Exception {<br>
var file = Files.createTempFile("test", null);<br>
<br>
var r = new Region();<br>
r.setOnDragDetected(event -> {<br>
event.setDragDetect(true);<br>
Dragboard db =
r.startDragAndDrop(TransferMode.MOVE);<br>
var cc = new ClipboardContent();<br>
cc.putFiles(List.of(file.toFile()));<br>
db.setContent(cc);<br>
event.consume();<br>
});<br>
<br>
r.setOnDragDone(event -> {<br>
System.out.println("Accepted: " +
event.isAccepted());<br>
System.out.println(event);<br>
});<br>
<br>
var scene = new Scene(r, 450, 500);<br>
primaryStage.setScene(scene);<br>
primaryStage.setTitle("Test");<br>
primaryStage.show();<br>
}<br>
}</code></p>
<p><code><br>
</code></p>
<p>I looked through the documentation of DragEvent but I'm still not
really sure whether this is a bug. The documentation of DragEvent
is a little bit light when it comes to behavior of drag events
that go to the system itself.</p>
<p>Best<br>
Christopher Schnick<br>
</p>
</body>
</html>