6826074: JScrollPane does not revalidate the component hierarchy after scrolling
authoralexp
Mon, 28 Feb 2011 18:20:34 +0300
changeset 8524 f2fac94f2434
parent 8523 864a651f7b53
child 8525 08f98f5a11df
6826074: JScrollPane does not revalidate the component hierarchy after scrolling Reviewed-by: anthony
jdk/src/share/classes/javax/swing/DefaultDesktopManager.java
jdk/src/share/classes/javax/swing/JViewport.java
--- a/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java	Thu Feb 24 16:29:42 2011 +0900
+++ b/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java	Mon Feb 28 18:20:34 2011 +0300
@@ -174,6 +174,8 @@
         if(!wasIcon(f)) {
             Rectangle r = getBoundsForIconOf(f);
             desktopIcon.setBounds(r.x, r.y, r.width, r.height);
+            // we must validate the hierarchy to not break the hw/lw mixing
+            desktopIcon.revalidate();
             setWasIcon(f, Boolean.TRUE);
         }
 
@@ -453,11 +455,9 @@
 
     /** This moves the <code>JComponent</code> and repaints the damaged areas. */
     public void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight) {
-        boolean didResize = (f.getWidth() != newWidth || f.getHeight() != newHeight);
         f.setBounds(newX, newY, newWidth, newHeight);
-        if(didResize) {
-            f.validate();
-        }
+        // we must validate the hierarchy to not break the hw/lw mixing
+        f.revalidate();
     }
 
     /** Convenience method to remove the desktopIcon of <b>f</b> is necessary. */
--- a/jdk/src/share/classes/javax/swing/JViewport.java	Thu Feb 24 16:29:42 2011 +0900
+++ b/jdk/src/share/classes/javax/swing/JViewport.java	Mon Feb 28 18:20:34 2011 +0300
@@ -1111,6 +1111,8 @@
                 view.setLocation(newX, newY);
                 repaintAll = false;
             }
+            // we must validate the hierarchy to not break the hw/lw mixing
+            revalidate();
             fireStateChanged();
         }
     }