JDK-7032814 : Swing HTML components after navigating back to applet page
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6u24
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2011-03-31
  • Updated: 2012-03-20
  • Resolved: 2011-10-26
Description
FULL PRODUCT VERSION :
jre6_u24

ADDITIONAL OS VERSION INFORMATION :
Windows XP (IE6, FireFox 4)
Fedora 14 (FireFox 4)
OSX 10.6.5 (Safari, apple java 6_u22)

A DESCRIPTION OF THE PROBLEM :
When the navigation is used to get back to a page that contained an applet, SWING's html components fail. They are not displayed, and e.g. JLabels with html-text report (0,0) as their preferred size.

We saw the issue with our swing based applet, wheer html in JLabels is used - customers reported after some browsing suddenly all navigation entries were gone.

Happens on a wide vairty of operating-systems and browsers.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Load the test-case using a browser
2. Both the html as well as the plain-text label is displayed
3. Navigate to another page in the same tab/window (e.g. sun.com)
4. Use the back-button to get back to the applet page
5. The applet is re-loaded, however the html-label is no longer displayed

It happens also under other conditions (sometimes at applet re-load), but using the back-button is the most reliable way to reproduce the bug.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Swing html components should not fail when applets are re-loaded or the user navigates using the browser.
ACTUAL -
java.awt.Dimension[width=80,height=15] //Initial load
java.awt.Dimension[width=0,height=0] //Second load using the back-button

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.applet.*;
import java.awt.*;
import javax.swing.*;


public class HtmlApplet extends Applet {
    public void init() {
	setLayout(new BorderLayout());
	add(new JLabel("Label with plain text works always"), BorderLayout.NORTH);
	
	JLabel label = new JLabel("<html><body><FONT COLOR=\"#0000ff\">  blablabalbla </FONT></body></html>");
	System.out.println(label.getPreferredSize());
	add(label, BorderLayout.CENTER);
    }
}




<html>
<BODY>
<APPLET CODEBASE = "." CODE = "HtmlApplet" WIDTH = "500"  HEIGHT = "500"></APPLET>
</body>
</html>

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