[5619] in java-interest
Re: Windows 95 REPAINT FIX is here NOW!!!
daemon@ATHENA.MIT.EDU (Richard Paymer)
Mon Feb 19 13:00:47 1996
From: "Richard Paymer" <rpaymer@hooked.net>
To: rpaymer@hooked.net, eric@onshore.com, alwalsh@alf2.tcd.ie,
chrisw@groupworks.com, jim_lowe@interramp.com, ivr@bart.nl,
lordbah@amusing.roc.servtech.com, aaviad@netvision.net.il,
java-interest@java.sun.com,
thethe@WPI.EDU (Benjamin "Quincy" Cabell V)
Date: Mon, 19 Feb 1996 07:12:55 +0000
Reply-to: rpaymer@hooked.net
> From: thethe@WPI.EDU (Benjamin "Quincy" Cabell V)
> To: rpaymer@hooked.net, eric@onshore.com, alwalsh@alf2.tcd.ie,
> chrisw@groupworks.com, jim_lowe@interramp.com, ivr@bart.nl,
> lordbah@amusing.roc.servtech.com, aaviad@netvision.net.il,
> java-interest@java.sun.com
> Subject: Windows 95 REPAINT FIX is here NOW!!!
> Date: Mon, 19 Feb 1996 02:13:18 GMT
> Hello -
>
> I think this information might make some of you very, very happy. It
> made me very happy. I thought I should pass it along immediately, and
> hopefully save some people a whole lot of aggravation.
>
> While the official release of Java 1.0.1 is "a couple of months away"
> according to Tom Ball (Java Products Group), it seems that Borland has
> gotten a newer awt.dll (and some other Java binaries) than 1.0. This
> newer version has fixed the repainting problems for my Java
> applets/stand-alone apps and I certainly would assume it'll do the
> same for you. So...
>
Much better! It definitely seems to fix the worst of the painting
problems (incorrectly painting some of the components on a panel at
startup). Now, if only this code would find it's way into a Netscape
release I'd stop getting bug reports every day from Net surfers using
my Java apps.
It doesn't fix all the problems I've observed though. I still see
the problem described below (and I'd love it if someone confirmed
that this is a real problem):
--------------------
1. This is a bug report, not a feature request.
2. It applies to the Java Development Kit. The problem is also
present in Netscape Beta 2.05. (And 2.06, and the production 2.0
version).
3. I am using the Java Development Kit Beta 2.
(I've since confirmed this with the JDK production version, and
the Borland debugger updates on 2/18/96).
4. In some common cases, copyArea results in a wildly flickering
screen. To get this uncomfortable effect, execute copyArea to move a
strip down vertically. When this executes, have part of the strip in
a window that is not completely visible. For example, move the
appletviewer window to the right of the screen so that only half of the
strip is visible. When you move the window back to the left, part of
the area that was copied flickers uncontrollably.
5. I observed this problem on MS Windows 95, with a 486-50MHz
machine, a screen size of 640x480 pixels, and 12MB of memory.
6. I have appended a sample Java program to demonstrate the problem.
-------------
// copyAreaBug class: Demonstrate Bug in java copyArea.
//
// Author: Richard Paymer
// rpaymer@hooked.net
//
//
// Environment: The bug was demonstrated in the following environment.
// Microsoft Windows 95, 486-50MHz CPU. 12MB memory.
// Java Development Kit Beta 2 (JDK2).
// Also Java Development Kit production release 1.
// Also after loading Borland debugger on 2/18/96
//
//
// Algorithm:
// Draw a blue box.
// Shift it down by one pixel every few hundred milliseconds.
// Color what was the top row of pixels red.
// The effect is that the box looks like it shifted down
// one pixel.
//
// To demonstrate the appletviewer / Netscape bug:
// Execute the program.
// While it is running, and the rectangle is gliding down the
// screen, reposition the appletviewer window so that part
// of the rectangle is off the screen on the right (and part
// of the rectangle is still visible on the screen).
// After a few seconds, move the window back to the left, so
// that the entire rectangle is now visible.
// You will observe a flickering area of the screen. This
// area continues to flicker until something causes a
// a full screen repaint (example: minimize, then restore
// the window).
//
// Some thoughts on the nature of the bug.
// The bug seems to be related to copyArea. It appears that
// copyArea has serious problems if some of the pixels
// are in a part of the Window not currently visible on
// the screen.
// An interesting observation: The paint() routine is called
// continuously while the screen is flickering. This
// goes on even after the timer loop completes.
//
// 01/14/96 - First Try. Bug isolated from a much more complex program.
import java.awt.*;
import java.applet.Applet;
public class copyAreaBug extends Applet {
// The initialization routine.
public void init() {
add(new movingRect(200, 300));
repaint();
}
}
class movingRect extends Canvas implements Runnable {
int width, height;
Thread kicker = null;
boolean finished;
int boxWidth;
int boxHeight;
int shiftAmount;
public movingRect (int wid, int ht) {
width = wid;
height = ht;
resize(width, height);
finished = false;
boxWidth = width;
boxHeight = height/8;
shiftAmount = 0;
kicker = new Thread(this);
kicker.start();
}
public void run() {
while (!finished) {
int timeout = 250; // Sleep for 250 ms.
try {Thread.currentThread().sleep(timeout);}
catch (InterruptedException e){}
repaint();
}
}
// A quick lesson in the geometry of our object (you need to
// view this in a fixed font:
//
// +-------------------------+ <---- 0
// | |
// | RED |
// | |
// +-------------------------| <---- shiftAmount
// | BLUE |
// | |
// +-------------------------+ <---- shiftAmount + boxHeight
// | |
// | RED |
// | |
// +-------------------------+ <---- height
public synchronized void update(Graphics g) {
if ((boxHeight + shiftAmount) < height) {
// We have not yet reached the bottom. Shift the
// blue box down by one pixel.
g.copyArea (0, shiftAmount,
boxWidth, shiftAmount + boxHeight,
0, 1);
// And fill in the old box top row with red.
g.setColor(Color.red);
g.fillRect(0, shiftAmount, boxWidth, 1);
// Increment the shiftAmount by one for next time.
shiftAmount++;
} else {
// We reached the bottom. Time to stop.
finished =true;
}
}
public synchronized void paint(Graphics g) {
System.out.println ("Entering Paint");
// Draw our blue rectangle.
g.setColor(Color.blue);
g.fillRect (0, 0, boxWidth, boxHeight);
// Shift it down by the proper amount.
g.copyArea(0, 0,
boxWidth, boxHeight,
0, shiftAmount);
// All above and below the rectangle is red.
g.setColor(Color.red);
g.fillRect(0, 0, boxWidth, shiftAmount);
g.fillRect(0, shiftAmount + boxHeight,
boxWidth, height - (shiftAmount + boxHeight));
}
}
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com