8023966: JViewPort.BLIT_SCROLL_MODE does not work in JLightweightFrame
authorpchelko
Fri, 30 Aug 2013 11:11:53 +0400
changeset 20104 113755166f65
parent 20103 f640c22218a3
child 20105 f698ce625852
8023966: JViewPort.BLIT_SCROLL_MODE does not work in JLightweightFrame Reviewed-by: anthony, ant
jdk/src/share/classes/javax/swing/JViewport.java
--- a/jdk/src/share/classes/javax/swing/JViewport.java	Wed Aug 28 17:32:25 2013 +0400
+++ b/jdk/src/share/classes/javax/swing/JViewport.java	Fri Aug 30 11:11:53 2013 +0400
@@ -25,6 +25,8 @@
 
 package javax.swing;
 
+import sun.swing.JLightweightFrame;
+
 import java.awt.*;
 import java.awt.event.*;
 import java.awt.peer.ComponentPeer;
@@ -361,6 +363,17 @@
         super.remove(child);
     }
 
+    @Override
+    public void addNotify() {
+        super.addNotify();
+        // JLightweightFrame does not support BLIT_SCROLL_MODE, so it should be replaced
+        Window rootWindow = SwingUtilities.getWindowAncestor(this);
+        if (rootWindow instanceof JLightweightFrame
+                && getScrollMode() == BLIT_SCROLL_MODE) {
+            setScrollMode(BACKINGSTORE_SCROLL_MODE);
+        }
+    }
+
 
     /**
      * Scrolls the view so that <code>Rectangle</code>