-
Bug
-
Resolution: Fixed
-
P4
-
1.3.0, 1.4.1
-
05
-
x86
-
windows_2000
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2043365 | 1.4.1 | Brent Christian | P4 | Resolved | Fixed | hopper |
Name: boT120536 Date: 05/06/2001
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
1. compile the following code:
import java.awt.*;
public class testawt3 extends java.awt.Frame {
Image backImg;
public testawt3() {
}
public void paint(Graphics g) {
try {
Dimension dim = getSize();
if (backImg == null) {
backImg = createImage(dim.width, dim.height);
} else if ((backImg.getWidth(null) != dim.width) ||
(backImg.getHeight(null) != dim.height))
{
backImg.flush();
backImg = createImage(dim.width, dim.height);
}
if (backImg != null) {
Graphics bg = backImg.getGraphics();
try {
System.out.println("no super paint\n");
// super.paint(bg);
System.out.println("yes draw image\n");
g.drawImage(backImg, 0, 0, null); // this is the line that
// is causing the problem
} finally {
bg.dispose();
}
}
return;
} catch (Exception e) {
// running on Solaris
// sometimes Windows AWT throws NPE on drawImage()
}
}
public static void main(String args[]) {
System.out.println("testawt3\n");
testawt3 test = new testawt3();
test.show();
}
}
2. Put these script in a batch file call testawt3.bat
REM -- This is for debugging only --
@set JDK12HOME=c:\\jdk1.3.1
%JDK12HOME%\jre\bin\java testawt3 %1% %2% %3% %4% %5% %6% %7% %8% %9%
3. Run this file as a Windows Service, to set it up follow the step
4. Get instsrv.exe and srvany.exe (part of the NT-resource kit)
5. Put srvany.exe in the txguardian directory
6. Run instsrv.exe like this:
instsrv testawt3 <testawt3-directory>\srvany.exe
4. Edit the registry, add a subkey called Parameters in
HKEY_Local_Machine\SYSTEM\CurrentControlSet\Services\testawt3
then create these string-values in that subkey
Application = c:\winnt\system32\cmd /k
AppParameters = <testawt3-directory>\testawt3.bat
AppDirectory = <testawt3-directory>
5. Start the testawt3 service, a console window should pop up
then you will see the awt.frame pops up,
6. Resize the frame (that will causes the paint rountine in the testawt3 class
to execute)
7. Open the Powerpoint document (you will see that some images on the top-right
are missing)
8. Stop the testawt3 service, close the console window and the testawt3 frame
9. Open the Powerpoint document (you will see that those images that were
missing appears)
If I comment out the "drawImage" call in paint, then
the problem will go out, so I suspect that it is with the dramImage
method. This problem can be easily and consistenly reproduced.
Although sometimes, it will seems to work fine, but if
you reboot the machine then the problem can be reproduce
again consistenly.
(Review ID: 123743)
======================================================================
Important note:
When installing the service as described above, it is important to change
the properties of the service as follows: In the "LogOn" tab of the properties
dialog for the service, check the "Allow service to interact with desktop".
This allows the program to actually run; without that option checked, the app
does not run and the problem is not apparent.
- backported by
-
JDK-2043365 AWT code causes images in a Powerpoint doc to disappear
- Resolved
- duplicates
-
JDK-4804511 AWT app hangs if another AWT app already running under SYSTEM account.
- Closed