List of usage examples for javafx.scene.control TextField setOnDragDropped
public final void setOnDragDropped(EventHandler<? super DragEvent> value)
From source file:fr.amap.lidar.amapvox.gui.MainFrameController.java
private void setDragDroppedSingleFileEvent(final TextField textField) { textField.setOnDragDropped(new EventHandler<DragEvent>() { @Override//from ww w. j a v a2 s . com public void handle(DragEvent event) { Dragboard db = event.getDragboard(); boolean success = false; if (db.hasFiles() && db.getFiles().size() == 1) { success = true; for (File file : db.getFiles()) { if (file != null) { textField.setText(file.getAbsolutePath()); } } } event.setDropCompleted(success); event.consume(); } }); }