changeset 8090:6432f8749e1d

8023966: JViewPort.BLIT_SCROLL_MODE does not work in JLightweightFrame Reviewed-by: anthony, ant
author pchelko
date Fri, 30 Aug 2013 11:11:53 +0400
parents 35644adc3269
children 7151f08eeadf
files src/share/classes/javax/swing/JViewport.java
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/javax/swing/JViewport.java	Wed Aug 28 17:32:25 2013 +0400
+++ b/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>