BUG: Scrolling Over Applet in IE Causes Improper Painting Behavior

ID: Q214780


The information in this article applies to:


SYMPTOMS

When you scroll up and down over a Java applet in a Web page, the components in the applet or the applet itself are repainted incorrectly and appear jumbled or corrupted.


CAUSE

The cause of this problem is not yet known. However, the behavior seems to be much more pronounced when the Use smooth scrolling check box is selected in Internet Explorer. To see the Use smooth scrolling check box in Internet Explorer, go to the View menu, click Internet Options, and click the Advanced tab.


RESOLUTION

Clear the Use smooth scrolling check box in Internet Explorer to eliminate, or significantly reduce, the occurrence of this problem.


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.


MORE INFORMATION

Steps to Reproduce Behavior

Compile and run the following code:

JAVA SOURCE:

import java.awt.*;
import java.applet.*;

public class PaintApplet extends Applet
{
	TestPanel tp;

	public void init()
	{
		setForeground(Color.cyan);
		setBackground(Color.blue.darker());
		setLayout(new BorderLayout());
		tp = new TestPanel();
		add(tp, "Center");
	}
}

class TestPanel extends Panel
{
	public void paint(Graphics g)
	{
		Dimension d = getSize();
		int x = d.width/5;
		int y = d.height;
		for (int i = 0; i < x; i++)
		{
			g.drawLine(i*8, 0, 0, y);
		}
	}
} 
HTML SOURCE:

<HTML>
<HEAD>
<TITLE>Painting Problem Page</TITLE>
</HEAD>
<BODY>

	<applet
		code=PaintApplet.class
		name=PaintApplet
		width=220
		height=600 VIEWASTEXT>
	</applet>

</BODY>
</HTML> 
RESULT: Scroll up and down over the applet using the Page Up and Page Down keys with the Use smooth scrolling check box selected in Internet Explorer. Notice how the lines drawn on the embedded panel become corrupted. This may take several tries because this problem occurs randomly.


REFERENCES

For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, please see the following pages on the Microsoft Technical Support site:

http://support.microsoft.com/support/visualj/

http://support.microsoft.com/support/java/


© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Joseph B. Hall, Microsoft Corporation



© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Bob LaCasse, Microsoft Corporation

Additional query words: AWTPkg


Keywords          : kbJavaVM kbSDKJava150bug kbGrpJava kbDSupport kbSDKJava310bug kbSDKJava320bug 
Version           : WINDOWS:
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: July 14, 1999