JDK-7021116 : Swing applets do not display in appletviewer unless they are resized.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_7
  • CPU: x86
  • Submitted: 2011-02-21
  • Updated: 2012-03-20
  • Resolved: 2011-05-04
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.
JDK 7
7Resolved
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b130)
Java HotSpot(TM) Client VM (build 21.0-b02, mixed mode, sharing)


ADDITIONAL OS VERSION INFORMATION :
Windows 7 x64
Windows XP

A DESCRIPTION OF THE PROBLEM :
Swing-based applets (including HelloWorld applet from the Java tutorials) do not display in the appletviewer unless the viewer is resized.  I have tried several applets, from several different sourcese, including the TumbleItem applet from the tutorials, and they all exhibit the same problem: none display in appletviewer unless the viewer is resized.

The problem does NOT occur if the applet is executed in a browser.  In otherwords, the swing-based applets work properly in a browser window, but not in the appletviewer.

All swing-based applets worked properly in previous releases, include JDK 1.4, JDK 5, and JDK 6.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try executing the HelloWorld applet from the Java tutorial using the appletviewer. Try the TumbleItem applet.

Here is the html to try for the HelloWorld applet:

<applet code="HelloWorld" width=300 height=100>
</applet>

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
You should see output from the applet displayed inside the appletviewer.
ACTUAL -
You won't see output until you resize the appletviewer.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
Use the HelloWorld.java code from the Java tutorials. Here is the link:

http://download.oracle.com/javase/tutorial/deployment/applet/getStarted.html
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Call invalidate() after initializing the GUI.

However, this fix is not very useful because it means that the example code provided by Oracle, and in many programming books, etc., won't work properly as-is in the appletviewer.

Comments
EVALUATION So basically, this is an issue with the appletviewer application - it doesn't validate the frame unconditionally, whilst it should. Please assign this to a team that supports the appletviewer app.
18-04-2011

EVALUATION The CRs 6986229 and 7002612 look like they've addressed the issue already. This should be a later regression, not directly related to the initial 6852592 fix I think. This work needs to be coordinated with the plugin team (see the mentioned CRs for contacts).
18-04-2011

EVALUATION source and html files are attached to test type appletviewer.exe HelloWorld.html
18-04-2011

EVALUATION frame.validate() doesn't unconditionally validate all the hierarchy any more, it stops on the first valid validate root invalidate() after adding the label does help
18-04-2011

EVALUATION It is reproducible on the latest JDK 7, regression caused by the fix for 6852592
18-04-2011