src/java.desktop/share/classes/javax/swing/JViewport.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

@@ -35,10 +35,12 @@
 import javax.swing.border.*;
 import javax.accessibility.*;
 
 import java.io.Serializable;
 
+import sun.awt.AWTAccessor;
+
 /**
  * The "viewport" or "porthole" through which you see the underlying
  * information. When you scroll, what moves is the viewport. It is like
  * peering through a camera's viewfinder. Moving the viewfinder upwards
  * brings new things into view at the top of the picture and loses

@@ -378,11 +380,10 @@
      * bounds.
      *
      * @param contentRect the <code>Rectangle</code> to display
      * @see JComponent#isValidateRoot
      * @see java.awt.Component#isValid
-     * @see java.awt.Component#getPeer
      */
     public void scrollRectToVisible(Rectangle contentRect) {
         Component view = getView();
 
         if (view == null) {

@@ -1446,22 +1447,22 @@
 
     /**
      * Returns true if the component needs to be completely repainted after
      * a blit and a paint is received.
      */
-    @SuppressWarnings("deprecation")
     private boolean needsRepaintAfterBlit() {
         // Find the first heavy weight ancestor. isObscured and
         // canDetermineObscurity are only appropriate for heavy weights.
         Component heavyParent = getParent();
 
         while (heavyParent != null && heavyParent.isLightweight()) {
             heavyParent = heavyParent.getParent();
         }
 
         if (heavyParent != null) {
-            ComponentPeer peer = heavyParent.getPeer();
+            ComponentPeer peer = AWTAccessor.getComponentAccessor()
+                                            .getPeer(heavyParent);
 
             if (peer != null && peer.canDetermineObscurity() &&
                                 !peer.isObscured()) {
                 // The peer says we aren't obscured, therefore we can assume
                 // that we won't later be messaged to paint a portion that