-
Bug
-
Resolution: Fixed
-
P3
-
fx2.0.2
-
Mac OSX 10.6.4/JDK6/b08
DragOver/DragDropped events are not received after putting file data into dragboard on Mac. Sample to reproduce:
public class Main extends Application {
Pane group;
public static void main(String[] args) {
launch(args);
}
private Parent getContent() {
VBox list = new VBox(10);
final Button btn = new Button("Button");
list.getChildren().add(btn);
btn.setOnDragDetected(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent t) {
System.out.println("OnDragDetected");
Dragboard db = btn.startDragAndDrop(TransferMode.MOVE);
System.out.println("Transfer modes: " + db.getTransferModes());
ClipboardContent cont = new ClipboardContent();
List<File> fl = new LinkedList<File>();
fl.add(new File("tmp.txt"));
cont.putFiles(fl);
db.setContent(cont);
t.consume();
}
});
btn.setOnDragOver(new EventHandler<DragEvent>() {
@Override
public void handle(DragEvent t) {
System.out.println("OnDragOver");
t.acceptTransferModes(TransferMode.ANY);
}
});
btn.setOnDragDropped(new EventHandler<DragEvent>() {
@Override
public void handle(DragEvent t) {
System.out.println("OnDragDropped");
t.setDropCompleted(true);
}
});
return list;
}
public void start(Stage stage) {
stage.setX(100);
stage.setY(100);
stage.setWidth(300);
stage.setHeight(300);
Scene scene = new Scene(group = new VBox());
group.getChildren().add(getContent());
group.getChildren().add(getContent());
stage.setScene(scene);
stage.show();
}
}
public class Main extends Application {
Pane group;
public static void main(String[] args) {
launch(args);
}
private Parent getContent() {
VBox list = new VBox(10);
final Button btn = new Button("Button");
list.getChildren().add(btn);
btn.setOnDragDetected(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent t) {
System.out.println("OnDragDetected");
Dragboard db = btn.startDragAndDrop(TransferMode.MOVE);
System.out.println("Transfer modes: " + db.getTransferModes());
ClipboardContent cont = new ClipboardContent();
List<File> fl = new LinkedList<File>();
fl.add(new File("tmp.txt"));
cont.putFiles(fl);
db.setContent(cont);
t.consume();
}
});
btn.setOnDragOver(new EventHandler<DragEvent>() {
@Override
public void handle(DragEvent t) {
System.out.println("OnDragOver");
t.acceptTransferModes(TransferMode.ANY);
}
});
btn.setOnDragDropped(new EventHandler<DragEvent>() {
@Override
public void handle(DragEvent t) {
System.out.println("OnDragDropped");
t.setDropCompleted(true);
}
});
return list;
}
public void start(Stage stage) {
stage.setX(100);
stage.setY(100);
stage.setWidth(300);
stage.setHeight(300);
Scene scene = new Scene(group = new VBox());
group.getChildren().add(getContent());
group.getChildren().add(getContent());
stage.setScene(scene);
stage.show();
}
}
- relates to
-
JDK-8127188 Mac: Drag and drop of files not working
- Resolved