8023966: JViewPort.BLIT_SCROLL_MODE does not work in JLightweightFrame
Reviewed-by: anthony, ant
--- 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>