FULL PRODUCT VERSION :
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
graphic card ATI Radeon 9600/X1050 series
A DESCRIPTION OF THE PROBLEM :
Here is the code of an overriding paint() method of a class that inherits from JFrame.
@Override
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
BufferedImage img = new
BufferedImage(getWidth(),27,BufferedImage.TYPE_INT_ARGB);
Graphics2D buffgr = (Graphics2D) img.getGraphics();
buffgr.setColor(Color.BLUE);
buffgr.fill(new Rectangle(0,0,getWidth(),27));
g2d.drawImage(img, 0, 0,null);
g2d.setColor(Color.RED);
g2d.fill(new Rectangle(0,27, getWidth(), getHeight() - 27));
}
On java version 1.6.0_10 the drawImage function redraws the entire workspace (getWidth(), getHeight()) and not only the image size. It draws the image and on the remaining space draws a background of a very light gray color, causing flickering. This does not appear on java 1.6.0_07, the function with this version draws only on the image size. Furthermore on version 1.6.0_10 cliping does not affect the drawImage() function and more generally using drawImage with version 1.6.0_10 works very more slowly than with version 1.6.0_7
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run the code joined, and resize the window. Flickering appears with version 1.6.0_10 and all works fine with version 1.6.0_7.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package bugreport;
import java.awt.*;
import java.awt.image.BufferedImage;
import javax.swing.JFrame;
class BJFrame extends JFrame {
@Override
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
BufferedImage img = new BufferedImage(getWidth(),150,BufferedImage.TYPE_INT_ARGB);
Graphics2D buffgr = (Graphics2D) img.getGraphics();
buffgr.setColor(Color.BLUE);
buffgr.fill(new Rectangle(0,0,getWidth(),150));
g2d.drawImage(img, 0, 0,null);
g2d.setColor(Color.RED);
g2d.fill(new Rectangle(0,150, getWidth(), getHeight() - 150));
}
}
public class Main {
public static void main(String[] args) {
BJFrame frame = new BJFrame();
frame.setBounds(150,150,600,400);
frame.setVisible(true);
}
}
---------- END SOURCE ----------
Release Regression From : 6u7
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.