From 2e5604d06b24176d92459274539ce01818019712 Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Fri, 30 Aug 2013 11:11:53 +0400 Subject: [PATCH] 8023966: JViewPort.BLIT_SCROLL_MODE does not work in JLightweightFrame Reviewed-by: anthony, ant --- jdk/src/share/classes/javax/swing/JViewport.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/jdk/src/share/classes/javax/swing/JViewport.java b/jdk/src/share/classes/javax/swing/JViewport.java index c2ea60bf0ec..c271533e53e 100644 --- a/jdk/src/share/classes/javax/swing/JViewport.java +++ b/jdk/src/share/classes/javax/swing/JViewport.java @@ -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 @@ public class JViewport extends JComponent implements Accessible 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 Rectangle