-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
1.4.0
-
Fix Understood
-
x86
-
windows_2000
Name: nt126004 Date: 01/17/2002
FULL PRODUCT VERSION :
java version "1.4.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b84)
Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed mode)
FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
ADDITIONAL OPERATING SYSTEMS :
Redhat Linux 7.1
Linux cad14 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown
A DESCRIPTION OF THE PROBLEM :
Paint an image cause too many paint() times in
J2DK1.4.0beta3 both in Windows2000 and Linux,
while prior versions work well.
The following is my test results of three Java2 versions in
Windows2000 and Redhat Linux7.1 ( each I tested for 5 times)
--------------------------------
1.4 beta3
linux 66 84 48 90 75
win2000 170 170 170 170 170
1.3.1
linux 3 3 3 3 3
win2000 2 2 2 2 2
1.2.2
linux 5 6 6 4 3
win2000 3 3 4 3 2
I guess it should be a bug!!!
----------------------------------
REGRESSION. Last worked in version 1.3.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile my program under J2SDK1.4.0 beta3 ( u can use
your image instead)
2. Run my program
3. Watch the title of the frame or the console for paint()
times.
EXPECTED VERSUS ACTUAL BEHAVIOR :
I think paint() times should be less than 10
This bug can be reproduced often.
---------- BEGIN SOURCE ----------
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.net.*;
public class JavaImgTest extends JFrame {
Image img;
int it = 0;
static String title = "Sooooooooo many paints ";
public JavaImgTest() {
super(title);
setSize(300, 200);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
img = loadImage("http", "www.cad.zju.edu.cn", "/home/zhaoyb/yi-s.jpg");
}
public void paint(Graphics g) {
it++;
setTitle(title + it);
System.out.println(it);
((Graphics2D) g).drawImage(img, 10, 25, this);
}
// this function from billday.com/Work
Image loadImage(String protocol, String machine, String file) {
//Create the URL object representing our image bits.
URL imageURL = null;
try {
imageURL = new URL(protocol,machine,file);
} catch (MalformedURLException e) {
System.out.println("Please verify your imageURL.");
System.exit(1);
}
//Now that we have a reference to the bits, let's create and
//return the actual Image object to store them.
Image myImage = getToolkit().getImage(imageURL);
return myImage;
}
public static void main(String[] args) {
JavaImgTest img1 = new JavaImgTest();
img1.show();
}
}
---------- END SOURCE ----------
(Review ID: 137589)
======================================================================
FULL PRODUCT VERSION :
java version "1.4.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b84)
Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed mode)
FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
ADDITIONAL OPERATING SYSTEMS :
Redhat Linux 7.1
Linux cad14 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown
A DESCRIPTION OF THE PROBLEM :
Paint an image cause too many paint() times in
J2DK1.4.0beta3 both in Windows2000 and Linux,
while prior versions work well.
The following is my test results of three Java2 versions in
Windows2000 and Redhat Linux7.1 ( each I tested for 5 times)
--------------------------------
1.4 beta3
linux 66 84 48 90 75
win2000 170 170 170 170 170
1.3.1
linux 3 3 3 3 3
win2000 2 2 2 2 2
1.2.2
linux 5 6 6 4 3
win2000 3 3 4 3 2
I guess it should be a bug!!!
----------------------------------
REGRESSION. Last worked in version 1.3.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile my program under J2SDK1.4.0 beta3 ( u can use
your image instead)
2. Run my program
3. Watch the title of the frame or the console for paint()
times.
EXPECTED VERSUS ACTUAL BEHAVIOR :
I think paint() times should be less than 10
This bug can be reproduced often.
---------- BEGIN SOURCE ----------
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.net.*;
public class JavaImgTest extends JFrame {
Image img;
int it = 0;
static String title = "Sooooooooo many paints ";
public JavaImgTest() {
super(title);
setSize(300, 200);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
img = loadImage("http", "www.cad.zju.edu.cn", "/home/zhaoyb/yi-s.jpg");
}
public void paint(Graphics g) {
it++;
setTitle(title + it);
System.out.println(it);
((Graphics2D) g).drawImage(img, 10, 25, this);
}
// this function from billday.com/Work
Image loadImage(String protocol, String machine, String file) {
//Create the URL object representing our image bits.
URL imageURL = null;
try {
imageURL = new URL(protocol,machine,file);
} catch (MalformedURLException e) {
System.out.println("Please verify your imageURL.");
System.exit(1);
}
//Now that we have a reference to the bits, let's create and
//return the actual Image object to store them.
Image myImage = getToolkit().getImage(imageURL);
return myImage;
}
public static void main(String[] args) {
JavaImgTest img1 = new JavaImgTest();
img1.show();
}
}
---------- END SOURCE ----------
(Review ID: 137589)
======================================================================