Hi Jeff,

I see what you're trying to achieve. I don't believe we've implemented anything specifically to support this case. No, I wouldn't expect to receive the OnMouseDragOver event in this case because it's only sent to a drop target when the mouse cursor is moving above it. In your case the button being dragged and the mouse cursor never move relative to each other, and hence the DragOver event just can't happen.

Do regular mouse events get delivered to the button? I suppose they don't... Well...

A hackish and extremely ineffective way to implement this would be to poll the current mouse pointer position using AWT APIs (MouseInfo) on a standalone thread and move the custom drag view accordingly. Or wait till RT-35812 is implemented.

best regards,

On 4/22/2014 2:39 AM, Jeff Martin wrote:
So I'm correct that calling Node.startFullDrag() should result in the 
OnMouseDragOver method getting called? I wasn't sure I had that right - and I 
really need a OnMouseDragMoved notification anyway.

My Sample code is below. If you think it should result in a bunch of 
onMouseDragOver.Handler printlns, I'll file a bug.


public void start(Stage aStage)
     // Create Button with DragDetected.Handler to 
     final Button button = new Button("Hello World");
     button.setOnDragDetected(new EventHandler() {
         public void handle(Event anEvent) {
             Dragboard db = button.startDragAndDrop(TransferMode.ANY);
             ClipboardContent cc = new ClipboardContent(); cc.putString("Hello 
             db.setContent(cc); anEvent.consume();

     // Listen to DragSource events
     button.setOnMouseDragOver(new EventHandler<MouseDragEvent>() {
         public void handle(MouseDragEvent e) { System.out.println(e); }

     // Add button to pane and stage and show
     Pane pane = new Pane(); pane.setPrefSize(400,400);
     pane.getChildren().add(button); button.resizeRelocate(100,100,100,100);
     aStage.setScene(new Scene(pane)); aStage.show();

On Apr 21, 2014, at 8:45 AM, Anthony Petrov <anthony.pet...@oracle.com> wrote:

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 

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 

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,

Reply via email to