Drag and Drop Events in JavaFX TableView

I would like to add Drag and Drop support to my JavaFX application. My requirement is that if someone drags files from the Native file system and drops to the JavaFX TableView , then he should recognize the drop event and how can I get a list of drpped files.

+4
source share
1 answer

I would use official JavaFX 2 docs.

http://docs.oracle.com/javafx/2/drag_drop/jfxpub-drag_drop.htm

http://docs.oracle.com/javafx/2/drag_drop/HelloDragAndDrop.java.html

So, you can understand the methods you will need to handle drag and drop events:

target.setOnDragOver

target.setOnDragEntered

target.setOnDragExited

target.setOnDragDropped

Then with DragEvent in these events, you can use getDragboard () to access the drag and drop content that inherits Clipboard . From here, you have several methods, such as getFiles , that you need.

+4
source

All Articles