JDK-6877797 : paintComponent used one or many times with jre1.6.0_07 and jre1.6.016
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 6u16,6u18,7,8,9
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: generic,windows_vista
  • CPU: generic,x86
  • Submitted: 2009-09-01
  • Updated: 2021-07-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.6.0_16"
java (TM) SE Runtime environment (build 1.6.0_16-b01)
Java HotSpot (TM) Client VM (build 14.2-b01, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Vista edition familiale premium


EXTRA RELEVANT SYSTEM CONFIGURATION :
Intel(p)Core(TM)2 Quad CPU q 6600 @ 2,40GHz Fujitsu Siemens

A DESCRIPTION OF THE PROBLEM :
Below you will see the little program used to shown the problem with paintComponent(..).

If I run this program with "jre1.6.0_16", paintComponent is runned two or three times.
if I run this program with "jre1.6.0_07", paintcomponent is runned just one time. (That is good for my use).

Is it possible to run paintComponent only one time under "jre1.6.0_16".

I seems this modification is between "jre1.6.0_7" and "jre1.6.0_10".

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Let see the test program below only to run it

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Is it possible to run paintComponent only one time under "jre1.6.0_16".
ACTUAL -
Described above

ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error message

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.JFrame;

public class Test
 {
  public static void main(String[] args)
   {
    JFrame Fenetre = new Fenetre();
   }
 }
import javax.swing.JFrame;

public class Fenetre extends JFrame
 {
  public Fenetre()
   {
    this.setTitle("Test");
    this.setSize(100, 150);
    this.setLocationRelativeTo(null);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setContentPane(new Panneau());
    this.setVisible(true);
   }
 }
import javax.swing.JPanel;
import java.awt.Graphics;

public class Panneau extends JPanel
 {
  public void paintComponent(Graphics g)
   {
	System.out.println("Passage paintComponent");
	g.fillOval(20,20,75,75);
   }
 }
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
I am looking for one methode but without suiccess for instance

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.

Comments
not a regression in 9
16-05-2014

EVALUATION It turned out that enabled d3d caused JFrame.paint() method to be called more than once. The following VM key turnes the acceleration off: -Dsun.java2d.d3d=false Despite the fact that it is not specified how many times a window should be painted on startup, the Swing believes that it should painted once, see #4939857 If Java2D team disagrees with that feel free to close the bug and we'll remove the regression test mentioned in #6892330
24-05-2010