src/java.desktop/windows/classes/sun/awt/windows/WScrollPanePeer.java

Print this page

        

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

@@ -27,10 +27,11 @@
 import java.awt.*;
 import java.awt.event.AdjustmentEvent;
 import java.awt.peer.ScrollPanePeer;
 
 import sun.awt.AWTAccessor;
+import sun.awt.AWTAccessor.ComponentAccessor;
 import sun.awt.PeerEvent;
 
 import sun.util.logging.PlatformLogger;
 
 final class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {

@@ -197,11 +198,10 @@
             this.pos = pos;
             this.isAdjusting = isAdjusting;
         }
 
         @Override
-        @SuppressWarnings("deprecation")
         public void run() {
             if (getScrollChild() == null) {
                 return;
             }
             ScrollPane sp = (ScrollPane)WScrollPanePeer.this.target;

@@ -265,22 +265,23 @@
                                                                         type);
 
             // Paint the exposed area right away.  To do this - find
             // the heavyweight ancestor of the scroll child.
             Component hwAncestor = getScrollChild();
+            final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
             while (hwAncestor != null
-                   && !(hwAncestor.getPeer() instanceof WComponentPeer))
+                   && !(acc.getPeer(hwAncestor) instanceof WComponentPeer))
             {
                 hwAncestor = hwAncestor.getParent();
             }
             if (log.isLoggable(PlatformLogger.Level.FINE)) {
                 if (hwAncestor == null) {
                     log.fine("Assertion (hwAncestor != null) failed, " +
                              "couldn't find heavyweight ancestor of scroll pane child");
                 }
             }
-            WComponentPeer hwPeer = (WComponentPeer)hwAncestor.getPeer();
+            WComponentPeer hwPeer = acc.getPeer(hwAncestor);
             hwPeer.paintDamagedAreaImmediately();
         }
     }
 
 }