src/share/classes/java/awt/dnd/DropTarget.java

Print this page

        

*** 349,358 **** --- 349,360 ---- * is active and <code>dtde</code> is <code>null</code> * * @see #isActive */ public synchronized void dragEnter(DropTargetDragEvent dtde) { + isDraggingInside = true; + if (!active) return; if (dtListener != null) { dtListener.dragEnter(dtde); } else
*** 419,428 **** --- 421,432 ---- * @param dte the <code>DropTargetEvent</code> * * @see #isActive */ public synchronized void dragExit(DropTargetEvent dte) { + isDraggingInside = false; + if (!active) return; if (dtListener != null && active) dtListener.dragExit(dte); clearAutoscroll();
*** 442,451 **** --- 446,457 ---- * no a <code>DropTargetListener</code> registered. * * @see #isActive */ public synchronized void drop(DropTargetDropEvent dtde) { + isDraggingInside = false; + clearAutoscroll(); if (dtListener != null && active) dtListener.drop(dtde); else { // we should'nt get here ...
*** 530,539 **** --- 536,549 ---- public void removeNotify(ComponentPeer peer) { if (nativePeer != null) ((DropTargetPeer)nativePeer).removeDropTarget(this); + if (isDraggingInside) { + dragExit(new DropTargetEvent(getDropTargetContext())); + } + componentPeer = nativePeer = null; } /** * Gets the <code>DropTargetContext</code> associated
*** 853,858 **** --- 863,873 ---- /* * The FlavorMap */ private transient FlavorMap flavorMap; + + /* + * If the dragging is currently inside this drop target + */ + private transient boolean isDraggingInside; }