jdk/src/java.desktop/share/classes/javax/swing/JComponent.java
changeset 30469 bac0a7ff7e1e
parent 29259 57e6ba59a1b3
child 32485 e00f713e6103
--- a/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java	Fri Apr 17 12:32:46 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java	Fri Apr 17 16:54:13 2015 +0300
@@ -57,6 +57,7 @@
 import static javax.swing.ClientPropertyKey.*;
 import javax.accessibility.*;
 
+import sun.awt.AWTAccessor;
 import sun.awt.SunToolkit;
 import sun.swing.SwingUtilities2;
 import sun.swing.UIClientPropertyKey;
@@ -4218,9 +4219,10 @@
      * @param c  the {@code Component} to be checked
      * @return true if this component is lightweight
      */
-    @SuppressWarnings("deprecation")
     public static boolean isLightweightComponent(Component c) {
-        return c.getPeer() instanceof LightweightPeer;
+        // TODO we cannot call c.isLightweight() because it is incorrectly
+        // overriden in DelegateContainer on osx.
+        return AWTAccessor.getComponentAccessor().isLightweight(c);
     }
 
 
@@ -5033,7 +5035,6 @@
         this.paintingChild = paintingChild;
     }
 
-    @SuppressWarnings("deprecation")
     void _paintImmediately(int x, int y, int w, int h) {
         Graphics g;
         Container c;
@@ -5159,7 +5160,7 @@
         }
 
         // If the clip width or height is negative, don't bother painting
-        if(c == null || c.getPeer() == null ||
+        if(c == null || !c.isDisplayable() ||
                         paintImmediatelyClip.width <= 0 ||
                         paintImmediatelyClip.height <= 0) {
             recycleRectangle(paintImmediatelyClip);