src/java.desktop/unix/classes/sun/awt/X11/XWindow.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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

@@ -32,10 +32,11 @@
 
 import java.lang.ref.WeakReference;
 
 import java.lang.reflect.Method;
 
+import sun.awt.AWTAccessor.ComponentAccessor;
 import sun.util.logging.PlatformLogger;
 
 import sun.awt.*;
 
 import sun.awt.image.PixelConverter;

@@ -280,38 +281,38 @@
 
     boolean isReparented() {
         return reparented;
     }
 
-    @SuppressWarnings("deprecation")
     static long getParentWindowID(Component target) {
 
-        ComponentPeer peer = target.getParent().getPeer();
         Component temp = target.getParent();
+        final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
+        ComponentPeer peer = acc.getPeer(temp);
         while (!(peer instanceof XWindow))
         {
             temp = temp.getParent();
-            peer = temp.getPeer();
+            peer = acc.getPeer(temp);
         }
 
         if (peer != null && peer instanceof XWindow)
             return ((XWindow)peer).getContentWindow();
         else return 0;
     }
 
 
-    @SuppressWarnings("deprecation")
     static XWindow getParentXWindowObject(Component target) {
         if (target == null) return null;
         Component temp = target.getParent();
         if (temp == null) return null;
-        ComponentPeer peer = temp.getPeer();
+        final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
+        ComponentPeer peer = acc.getPeer(temp);
         if (peer == null) return null;
         while ((peer != null) && !(peer instanceof XWindow))
         {
             temp = temp.getParent();
-            peer = temp.getPeer();
+            peer = acc.getPeer(temp);
         }
         if (peer != null && peer instanceof XWindow)
             return (XWindow) peer;
         else return null;
     }

@@ -550,11 +551,11 @@
         int y = xe.get_y();
         int w = xe.get_width();
         int h = xe.get_height();
 
         Component target = getEventSource();
-        AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
+        ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
 
         if (!compAccessor.getIgnoreRepaint(target)
             && compAccessor.getWidth(target) != 0
             && compAccessor.getHeight(target) != 0)
         {