Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Get JavaFX Drag and Drop target Folder

GoXR3PlusMay 29 2016 — edited Sep 23 2016

A container with a lot of buttons exist,where each button has a name which represents an absolute file path.So when the button is dragged to a folder or desktop(let's say in Windows) it is copied by user's Operating System:(Code)

button.setOnDragDetected(event -> {

  
/* allow copy transfer mode */
  
Dragboard db =  startDragAndDrop(TransferMode.COPY,TransferMode.LINK);

  
/* put a string on dragboard */
  
ClipboardContent content = new ClipboardContent();

  
/*Adding a file into the ClipboardContent*/
  content
.putFiles(Arrays.asList(new File(getSongPath())));

  
........

  db
.setContent(content);

  event
.consume();

  
}

The problem:

What i want is when the drop is done to get the folder where the file|files have been dropped..so i can make a progress bar for big files..Here says that it can be done but when i try to get GestureTarget it is null.

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 21 2016
Added on May 29 2016
2 comments
2,343 views