Ideas for a DragAndDrop-Library

Hi there,
due to current and general reason i am interested in finding/creating a solution to bring back drag-and-drop-support(D&D) to processing 3.0 sketches. Meaning, dragging and dropping files from and especially to a running processing sketch (to/from the OS).

Prior to P5v3.0 this was an easy task with @sojamo 's sDrop-Library. sDrop heavily relies on java's build in D&D-support (java.awt.dnd / java.awt.datatransfer), hence on awt and Component. As P5v3.0 is "dropping" awt, sDrop not just does not work anymore, but also seems not the right direction to go for v3.0-D&D-support.

JavaFX provides functionality for D&D (javafx.scene.input), but in my understanding, this more or less assumes a "full" JavaFX-Application (based on Nodes/Scenes), which isn't the case for P5v3.0 either!?

Furthermore P5v3.0 seems to change the underlying "windowing-technology" dependent on the chosen renderer:

* JAVA2D - javax.swing.JFrame
* P2D / P3D - com.jogamp.newt.opengl.GLWindow
* FX2D - javafx.stage.Window

Which makes it even more difficult to build upon some java-API-functionalities!?

Are my assumptions right? Am i totally wrong?

Is there yet any effort in implementing D&D?

Do you have any ideas/corrections/suggestions on how to implement a platform- and renderer-independent D&D-library for Processing 3.0?

Thanks for your thoughts!


  • Hi benson, i just came across your post since i needed to get some quick drag and drop functionality for one of my sketches. I think you are right that we would somehow need to access the underlying window toolkit for cross platform D&D functionality. From my understanding Processing itself abstracts itself from this layer by using PSurface. That might be a starting point to implement D&D?

    Since i needed something quick, there is a way of still using sDrop with Processing 3.0 (i guess at least with the 2D render ?). Replacing drop = new SDrop(this); with drop = new SDrop((Component)this.surface.getNative(), this); did the trick for me.

Sign In or Register to comment.