JDK-6434412 : Error in the paint method of JDialog
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Incomplete
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-06-06
  • Updated: 2022-09-16
  • Resolved: 2022-09-16
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.5.0_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Windows XP SP2

A DESCRIPTION OF THE PROBLEM :
I have found that the paint method does not work correctly under JAVA 1.5
if you try to use it for drawing on the main panel (using getContentPane method).

Please try this application I have developed to understand what I'm talking about. run the application under java 1.5 and java 1.4.2. Press on the middle button (ToolTipText: "how to win"). and see the difference between the two versions.
http://amt4u.150m.com/AMTGame.jar

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Write a class that extends JDialog and use the paint method to draw something (pic as an example) on the main panel (use getContentPane method). in run-timme nothing is drawn!!

Please try this application I have developed to understand what I'm talking about. run the application under java 1.5 and java 1.4.2. Press on the middle button (ToolTipText: "how to win") and then the exit button. See the difference between the two versions.
http://amt4u.150m.com/AMTGame.jar


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
In generl, the paint should draw somthing on the main panel
ACTUAL -
nothing is dwan

ERROR MESSAGES/STACK TRACES THAT OCCUR :
no error

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
see this application
http://amt4u.150m.com/AMTGame.jar

---------- END SOURCE ----------

Comments
No test
16-09-2022

EVALUATION This is likely the result of the fix for 4939857. As part of that fix it's possible that paint will not be invoked on a Window. This isn't the first time to come up though, and is likely worth a backport now (it's not an issue in 1.6 do to extensive changes to Swing and AWT's painting code). Will leave open to target to an update release.
07-06-2006