JFXPanel Dragboard setDragView

Anthony Petrov anthony.petrov at oracle.com
Mon Apr 21 13:45:35 UTC 2014


Hi Jeff,

On 4/18/2014 6:43 PM, Jeff Martin wrote:
> I'm trying to figure out how to implement a version of Dragboard.setDragView() that works with JFXPanel (which isn't currently supported). Years ago I did this in Swing by creating a window that followed the mouse around (at an offset, so it wouldn't take all the DragOver events).
>
> I created a Popup Window and added an ImageView, but I can't figure out how to get the equivalent of DragSource events. I thought I could just call source.startFullDrag() in my DragDetected method then I would get MouseDrag events on my source, but that isn't happening. Is this a bug or am I doing something wrong?

Please file a new JIRA and provide a small test case that demonstrates 
the problem.

> Also, when I get my Popup moving, I'd really like it to be exactly under the mouse but have the Popup be MouseTransparent (or forward events to the window underneath).

You could use the TRANSPARENT style for your popup window and paint a 
transparent hole (alpha == 0) in its center (or wherever you need it), 
and keep the popup positioned so that the mouse pointer is located above 
the hole. Mouse events always pass through transparent pixels. This way 
mouse events will get delivered to a window below the popup window in 
the z-order, while the popup window itself can float above it following 
the mouse cursor.

--
best regards,
Anthony


More information about the openjfx-dev mailing list