0

I've got 2 ListViews (A and B) of the same base type. What I need to implement is: - user drags items from A, drops them into B - user drags items from B, drops them into B(rearrangement).

The changes has to be saved in an sqlite table. 2 different sql query runs, so the drag and drops must have a different outcome.

If I do 2X B.setOnDragDropped, can I differentiate the 2 depending on where did the drag start?

Thanks for your help, much apprich folks

Laszlo Moricz
  • 11
  • 1
  • 3

1 Answers1

2

If you call setOnDragDropped(...) twice on the same node, the second handler will replace the first one (it is a set method, and works the same way as any other set method: it sets the value of a property).

You need something along the lines of

listViewB.addEventHandler(DragEvent.DRAG_DROPPED, e -> {
    // handler code here...
});

You can determine the source of the drag inside the handler with

    e.getGestureSource()

and see which node it matches to determine the course of action.

James_D
  • 201,275
  • 16
  • 291
  • 322