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

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -47,10 +47,13 @@
 import javax.swing.Timer;
 import java.awt.peer.ComponentPeer;
 import java.awt.peer.LightweightPeer;
 import java.awt.dnd.peer.DropTargetPeer;
 
+import sun.awt.AWTAccessor;
+import sun.awt.AWTAccessor.ComponentAccessor;
+
 
 /**
  * The <code>DropTarget</code> is associated
  * with a <code>Component</code> when that <code>Component</code>
  * wishes

@@ -497,19 +500,19 @@
      *
      * @param peer The Peer of the Component we are associated with!
      *
      */
 
-    @SuppressWarnings("deprecation")
     public void addNotify(ComponentPeer peer) {
         if (peer == componentPeer) return;
 
         componentPeer = peer;
+        final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
 
         for (Component c = component;
              c != null && peer instanceof LightweightPeer; c = c.getParent()) {
-            peer = c.getPeer();
+            peer = acc.getPeer(c);
         }
 
         if (peer instanceof DropTargetPeer) {
             nativePeer = peer;
             ((DropTargetPeer)peer).addDropTarget(this);