I think the easiest way to approach this is to register the drag handlers with the graphic associated with the tab, instead of with the tab pane. If(event.getTransferMode() = TransferMode.MOVE) ("from " + dragboard.getString() + " to " + target) ("source : " + tabPane.getSelectionModel().getSelectedIndex()) Įvent.acceptTransferModes(TransferMode.COPY_OR_MOVE) ĭragboard dragboard = event.getDragboard() ("target : " + target) ĭragboard dragboard = tabPane.startDragAndDrop(TransferMode.ANY) ĬlipboardContent clipboardContent = new ClipboardContent() ĬlipboardContent.putString(Integer.toString(tabPane.getSelectionModel().getSelectedIndex())) Public class DragAndDrop extends Application And yes, for SOME reason, hovering an object while holding the click button doesnt result in a mouseover event. So here's my code, it's not doing what I want because (and it's only a workaround) I only detect the "drop target" AFTER the drop was made, thus making it useless. ) which results in overcomplicated algorithms to compensate this weakness of the library. The main problem comes from the fact that a Tab cannot be bound with the setOnDragDetected, setOnDragOver etc methods (for some reason that escapes me by the way. I've tried something, but it's not doing what I want. I'd like the behaviour that pretty much all the browsers have implemented. I've seen a lot on how to drag tabs of a tabpane to another, which by the way I don't see the point, I guess it can be useful to some extent but the most natural application should be to reorder tabs of the same tabpane, matter which nobody seems to talk about on the internet.
0 Comments
Leave a Reply. |