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

Print this page




  53 import java.awt.dnd.DragGestureEvent;
  54 import java.awt.dnd.DragGestureRecognizer;
  55 import java.awt.dnd.DragSource;
  56 import java.awt.dnd.DragSourceAdapter;
  57 import java.awt.dnd.DragSourceListener;
  58 import java.awt.dnd.DragSourceDropEvent;
  59 import java.awt.dnd.DropTarget;
  60 import java.awt.dnd.DropTargetAdapter;
  61 import java.awt.dnd.DropTargetDragEvent;
  62 import java.awt.dnd.DropTargetDropEvent;
  63 import java.awt.dnd.DropTargetEvent;
  64 import java.awt.dnd.DropTargetListener;
  65 import java.awt.dnd.InvalidDnDOperationException;
  66 
  67 import java.awt.event.InputEvent;
  68 import java.awt.event.MouseAdapter;
  69 import java.awt.event.MouseEvent;
  70 
  71 /**
  72  * An utility class to connect DnD mechanism of Swing and FX.

  73  */
  74 final class SwingDnD {
  75 
  76     private final Transferable dndTransferable = new DnDTransferable();
  77 
  78     private final DragSource dragSource;
  79     private final DragSourceListener dragSourceListener;
  80 
  81     // swingDragSource and fxDropTarget are used when DnD is initiated from
  82     // Swing or external process, i.e. this SwingDnD is used as a drop target
  83     private SwingDragSource swingDragSource;
  84     private EmbeddedSceneDTInterface fxDropTarget;
  85 
  86     // fxDragSource is used when DnD is initiated from FX, i.e. this
  87     // SwingDnD acts as a drag source
  88     private EmbeddedSceneDSInterface fxDragSource;
  89 
  90     private MouseEvent me;
  91 
  92     SwingDnD(final JComponent comp, final EmbeddedSceneInterface embeddedScene) {




  53 import java.awt.dnd.DragGestureEvent;
  54 import java.awt.dnd.DragGestureRecognizer;
  55 import java.awt.dnd.DragSource;
  56 import java.awt.dnd.DragSourceAdapter;
  57 import java.awt.dnd.DragSourceListener;
  58 import java.awt.dnd.DragSourceDropEvent;
  59 import java.awt.dnd.DropTarget;
  60 import java.awt.dnd.DropTargetAdapter;
  61 import java.awt.dnd.DropTargetDragEvent;
  62 import java.awt.dnd.DropTargetDropEvent;
  63 import java.awt.dnd.DropTargetEvent;
  64 import java.awt.dnd.DropTargetListener;
  65 import java.awt.dnd.InvalidDnDOperationException;
  66 
  67 import java.awt.event.InputEvent;
  68 import java.awt.event.MouseAdapter;
  69 import java.awt.event.MouseEvent;
  70 
  71 /**
  72  * An utility class to connect DnD mechanism of Swing and FX.
  73  * It allows FX content to use the AWT machinery for performing DnD.
  74  */
  75 final class SwingDnD {
  76 
  77     private final Transferable dndTransferable = new DnDTransferable();
  78 
  79     private final DragSource dragSource;
  80     private final DragSourceListener dragSourceListener;
  81 
  82     // swingDragSource and fxDropTarget are used when DnD is initiated from
  83     // Swing or external process, i.e. this SwingDnD is used as a drop target
  84     private SwingDragSource swingDragSource;
  85     private EmbeddedSceneDTInterface fxDropTarget;
  86 
  87     // fxDragSource is used when DnD is initiated from FX, i.e. this
  88     // SwingDnD acts as a drag source
  89     private EmbeddedSceneDSInterface fxDragSource;
  90 
  91     private MouseEvent me;
  92 
  93     SwingDnD(final JComponent comp, final EmbeddedSceneInterface embeddedScene) {