8023966: JViewPort.BLIT_SCROLL_MODE does not work in JLightweightFrame

Reviewed-by: anthony, ant
This commit is contained in:
Petr Pchelko 2013-08-30 11:11:53 +04:00
parent 0628977a7a
commit 2e5604d06b

View File

@ -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 <code>Rectangle</code>