From 23f78001e2cf3d728ae5c5abcbb21e64ac8d6d97 Mon Sep 17 00:00:00 2001 From: Alexander Potochkin Date: Mon, 28 Feb 2011 18:20:34 +0300 Subject: [PATCH] 6826074: JScrollPane does not revalidate the component hierarchy after scrolling Reviewed-by: anthony --- .../share/classes/javax/swing/DefaultDesktopManager.java | 8 ++++---- jdk/src/share/classes/javax/swing/JViewport.java | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java b/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java index 8ab24e56dd7..df3d6eb2ab5 100644 --- a/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java +++ b/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java @@ -174,6 +174,8 @@ public class DefaultDesktopManager implements DesktopManager, java.io.Serializab 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 @@ public class DefaultDesktopManager implements DesktopManager, java.io.Serializab /** This moves the JComponent 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 f is necessary. */ diff --git a/jdk/src/share/classes/javax/swing/JViewport.java b/jdk/src/share/classes/javax/swing/JViewport.java index 80a124a41dc..85f39b37387 100644 --- a/jdk/src/share/classes/javax/swing/JViewport.java +++ b/jdk/src/share/classes/javax/swing/JViewport.java @@ -1111,6 +1111,8 @@ public class JViewport extends JComponent implements Accessible view.setLocation(newX, newY); repaintAll = false; } + // we must validate the hierarchy to not break the hw/lw mixing + revalidate(); fireStateChanged(); } }