changeset 3794:e390ce4509c6

6826074: JScrollPane does not revalidate the component hierarchy after scrolling Reviewed-by: anthony
author alexp
date Mon, 28 Feb 2011 18:20:34 +0300
parents 01c752a48b51
children 1ef5b85d41f2
files src/share/classes/javax/swing/DefaultDesktopManager.java src/share/classes/javax/swing/JViewport.java
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/javax/swing/DefaultDesktopManager.java	Thu Feb 24 16:29:42 2011 +0900
+++ b/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/src/share/classes/javax/swing/JViewport.java	Thu Feb 24 16:29:42 2011 +0900
+++ b/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();
         }
     }