java - HTML no longer working in JLabel (and other components) -


i have java applet i've written , have been running quite while. in applet have bunch of jlabels use html in text content (which allowed, , has been working years). main reason use html allow line breaks in jlabels.

the issue: jlabels have html in them (some don't) stopped displaying text. think might have recent java update (java se 6 update 22, on 2010-oct-12) not 100 percent sure, problems did seem start around then. maybe bug has been introduced? or feature removed?

i tried jeditorpane , seemed have same issues when content html.

also important note first time load applet (first time java runtime starts) works fine, if refresh webpage has issues described.

does have similar issues? have insights? or doing dumb?

i made simple test applet , can reproduce issues 100% regularity (remembering first time runtime loads work fine, successive refreshes cause issues):

[helloworldapplet.java]

import javax.swing.*;  public class helloworldapplet extends japplet {     public void init()     {         this.add(new jlabel("hello (text)"), java.awt.borderlayout.north);         this.add(new jlabel("<html><body>hello (html)</body></html>"), java.awt.borderlayout.south);     } } 

[hellowworldapplet.html]

<html> <title>a test</title> <body>     <applet code="helloworldapplet.class" width="320" height="120">         need java     </applet> </body> </html> 

ps. i've been testing using chrome did breifly try in ie 8 also. (obviously) have latest java se 6 update 22 installed run time, , have matching update jdk. compile above test applet using simply: "javac helloworldapplet.java"

wasted afternoon looking cause of this, see following bug report http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6993691

the workaround in bug report is:

import javax.swing.*; import javax.swing.text.html.parser.parserdelegator;  public class helloworldapplet extends japplet {     public void init() {        parserdelegator workaround = new parserdelegator();        applet.add(new jlabel("hello (text)"), java.awt.borderlayout.north);        applet.add(new jlabel("<html>hello (html)</html>"),  java.awt.borderlayout.south);     } } 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -