src/share/classes/javax/swing/JViewport.java
Print this page
@@ -23,10 +23,12 @@
* questions.
*/
package javax.swing;
+import sun.swing.JLightweightFrame;
+
import java.awt.*;
import java.awt.event.*;
import java.awt.peer.ComponentPeer;
import java.beans.Transient;
import javax.swing.plaf.ViewportUI;
@@ -359,10 +361,21 @@
public void remove(Component child) {
child.removeComponentListener(viewListener);
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>
* within the view becomes visible.
* <p>