简体   繁体   中英

JButton html text not displayed after page refresh in Java applet

I am displaying some multiline text in a JButton within a Java applet using html tags.

When the web page containing the java applet is displayed for the first time the html text is rendered correctly. If the web page is refreshed, the JButton is shown with no text.

Debugging the applet, as it is running in the web page, shows that the html text is being applied correctly to the JButton.

Non-html text in the JButton is always displayed correctly.

Adding a revalidate() and repaint() call to the JButton just after creation causes the JButton to be displayed with no text every time (not just after a web-page refresh).

This effect is seen in Google Chrome, Firefox and Internet Explorer.

Modifying the content of the html text by appending a random number each time it is rendered make no difference.

How can I get the html content of the JButton to be displayed every time the page is refreshed?

See bug 6993691 for details & a workaround. Strangely, that bug is closed as a duplicate of another bug which is no longer available on the DB.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM