< prev index next >

modules/javafx.swing/src/main/java/javafx/embed/swing/FXDnD.java

Print this page




 521             if (!isDropTargetListenerInstalled) {
 522                 node.addEventHandler(DragEvent.DRAG_ENTERED, onDragEnteredHandler);
 523                 node.addEventHandler(DragEvent.DRAG_EXITED, onDragExitedHandler);
 524                 node.addEventHandler(DragEvent.DRAG_OVER, onDragOverHandler);
 525                 node.addEventHandler(DragEvent.DRAG_DROPPED, onDragDroppedHandler);
 526 
 527                 isDropTargetListenerInstalled = true;
 528             }
 529         });
 530     }
 531 
 532     public void removeDropTarget(DropTarget dt) {
 533         dropTargets.remove(dt.getComponent());
 534         Platform.runLater(() -> {
 535             if (isDropTargetListenerInstalled && dropTargets.isEmpty()) {
 536                 node.removeEventHandler(DragEvent.DRAG_ENTERED, onDragEnteredHandler);
 537                 node.removeEventHandler(DragEvent.DRAG_EXITED, onDragExitedHandler);
 538                 node.removeEventHandler(DragEvent.DRAG_OVER, onDragOverHandler);
 539                 node.removeEventHandler(DragEvent.DRAG_DROPPED, onDragDroppedHandler);
 540 
 541                 isDropTargetListenerInstalled = true;
 542             }
 543         });
 544     }
 545 }


 521             if (!isDropTargetListenerInstalled) {
 522                 node.addEventHandler(DragEvent.DRAG_ENTERED, onDragEnteredHandler);
 523                 node.addEventHandler(DragEvent.DRAG_EXITED, onDragExitedHandler);
 524                 node.addEventHandler(DragEvent.DRAG_OVER, onDragOverHandler);
 525                 node.addEventHandler(DragEvent.DRAG_DROPPED, onDragDroppedHandler);
 526 
 527                 isDropTargetListenerInstalled = true;
 528             }
 529         });
 530     }
 531 
 532     public void removeDropTarget(DropTarget dt) {
 533         dropTargets.remove(dt.getComponent());
 534         Platform.runLater(() -> {
 535             if (isDropTargetListenerInstalled && dropTargets.isEmpty()) {
 536                 node.removeEventHandler(DragEvent.DRAG_ENTERED, onDragEnteredHandler);
 537                 node.removeEventHandler(DragEvent.DRAG_EXITED, onDragExitedHandler);
 538                 node.removeEventHandler(DragEvent.DRAG_OVER, onDragOverHandler);
 539                 node.removeEventHandler(DragEvent.DRAG_DROPPED, onDragDroppedHandler);
 540 
 541                 isDropTargetListenerInstalled = false;
 542             }
 543         });
 544     }
 545 }
< prev index next >