Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Firefox and JEditorPane and JLabel

14 views
Skip to first unread message

Roedy Green

unread,
Jan 21, 2011, 12:13:01 PM1/21/11
to
I have noticed that JEditorPane or JLabel containing HTML don't show
up on Firefox, though they work fine on Chrome and Opera. I wondered
if anyone has heard about this problem and knows if there is a
workaround.

You can see the effect with on page
http://mindprod.com/applet/canadiantax.html
--
Roedy Green Canadian Mind Products
http://mindprod.com
To err is human, but to really foul things up requires a computer.
~ Farmer's Almanac
It is breathtaking how a misplaced comma in a computer program can
shred megabytes of data in seconds.

Daniele Futtorovic

unread,
Jan 21, 2011, 2:04:59 PM1/21/11
to
On 21/01/2011 18:13, Roedy Green allegedly wrote:
> I have noticed that JEditorPane or JLabel containing HTML don't show
> up on Firefox, though they work fine on Chrome and Opera. I wondered
> if anyone has heard about this problem and knows if there is a
> workaround.
>
> You can see the effect with on page
> http://mindprod.com/applet/canadiantax.html

Looks fine to me.

JRE 6.0.20
Firefox 3.6.12

df.

Lew

unread,
Jan 21, 2011, 6:57:01 PM1/21/11
to

"... the buyer’s home province ..."


--
Lew
Ceci n'est pas une pipe.

Roedy Green

unread,
Jan 22, 2011, 12:22:28 AM1/22/11
to
On Fri, 21 Jan 2011 20:04:59 +0100, Daniele Futtorovic
<da.fut...@laposte.net.invalid> wrote, quoted or indirectly quoted
someone who said :

>> You can see the effect with on page
>> http://mindprod.com/applet/canadiantax.html
>
>Looks fine to me.
>
>JRE 6.0.20
>Firefox 3.6.12

At the bottom of the applet box you should see some <li> style
instructions in green. The text of them is repeated below in the HTML.
I would have blamed the video driver, but the layout puts a bunch of
white space at the top, as if it thought the JEditorPane/JLabel
rendered to empty.

I have JRE 1.6.0_23. I have both 32 and 64 bit JREs installed.
System properties suggest it is using 32-bit.

When an applet starts, it leaves the box solid black for about a
second. This seems excessively long, and I wondered if it were
indicative of video driver bugs.

It would be nice to be able to include screen snapshot in newsgroup
postings to accurately describe what you are seeing or what you are
expected to see.

Daniele Futtorovic

unread,
Jan 22, 2011, 12:08:16 PM1/22/11
to
On 22/01/2011 06:22, Roedy Green allegedly wrote:
> On Fri, 21 Jan 2011 20:04:59 +0100, Daniele Futtorovic
> <da.fut...@laposte.net.invalid> wrote, quoted or indirectly quoted
> someone who said :
>
>>> You can see the effect with on page
>>> http://mindprod.com/applet/canadiantax.html
>> Looks fine to me.
>>
>> JRE 6.0.20
>> Firefox 3.6.12
>
> At the bottom of the applet box you should see some <li> style
> instructions in green. The text of them is repeated below in the HTML.
> I would have blamed the video driver, but the layout puts a bunch of
> white space at the top, as if it thought the JEditorPane/JLabel
> rendered to empty.
>
> I have JRE 1.6.0_23. I have both 32 and 64 bit JREs installed.
> System properties suggest it is using 32-bit.
>
> When an applet starts, it leaves the box solid black for about a
> second. This seems excessively long, and I wondered if it were
> indicative of video driver bugs.
>
> It would be nice to be able to include screen snapshot in newsgroup
> postings to accurately describe what you are seeing or what you are
> expected to see.

<http://i.imgur.com/MlJ4b.png>

John B. Matthews

unread,
Jan 22, 2011, 2:30:50 PM1/22/11
to
In article <h1qkj61hb7imbr91j...@4ax.com>,
Roedy Green <see_w...@mindprod.com.invalid> wrote:

> On Fri, 21 Jan 2011 20:04:59 +0100, Daniele Futtorovic
> <da.fut...@laposte.net.invalid> wrote, quoted or indirectly quoted
> someone who said :
>
> >> You can see the effect with on page
> >> http://mindprod.com/applet/canadiantax.html
> >
> >Looks fine to me.
> >
> >JRE 6.0.20
> >Firefox 3.6.12
>
> At the bottom of the applet box you should see some <li> style
> instructions in green. The text of them is repeated below in the
> HTML. I would have blamed the video driver, but the layout puts a
> bunch of white space at the top, as if it thought the
> JEditorPane/JLabel rendered to empty.
>
> I have JRE 1.6.0_23. I have both 32 and 64 bit JREs installed. System
> properties suggest it is using 32-bit.
>
> When an applet starts, it leaves the box solid black for about a
> second. This seems excessively long, and I wondered if it were
> indicative of video driver bugs.
>
> It would be nice to be able to include screen snapshot in newsgroup
> postings to accurately describe what you are seeing or what you are
> expected to see.

Mac OS X 10.5.8, Safari 5.0.3

<http://i54.tinypic.com/16i5b1f.png>

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>

Roedy Green

unread,
Jan 24, 2011, 5:28:22 AM1/24/11
to
On Sat, 22 Jan 2011 18:08:16 +0100, Daniele Futtorovic
That is what it is supposed to be.

I discovered this bug appears with all browsers, but only if you
setText gets called more than once. setText works the first time.

I feed it this html :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>instructions</title>
<style
type="text/css">body{background-color:#f8f8f8;color:#339911;font-family:Dialog,sans-serif;}</style>
</head>
<body>
<p>Select buyer&rsquo;s province, then either:</p>
<ul><li>Click the up/down <em>Amount of Sale</em> spinner arrows.</li>
<li>Fill in the <em>Amount of Sale</em>, then click <em>Calc
&#x21d3;</em> to find the <em>Total Payable</em>.</li>
<li>Fill in the <em>Total Payable</em>, then click <em>Calc
&#x21d1;</em> to find the original <em>Amount of Sale</em>.</li></ul>
<p>Out-of-province vendors must now collect the same tax as vendors in
the buyer&rsquo;s home province.</p>
</body>
</html>

which W3C says is fine.

For some reason Firefox calls init twice, that is why the bug showed
up there but not in other browsers. To make it appear in other
browsers, just navigate to some other page then navigate back.

Then you get an error like this:


java.lang.NullPointerException
at javax.swing.text.html.parser.Parser.errorContext(Unknown
Source)
at javax.swing.text.html.parser.Parser.parse(Unknown Source)
at javax.swing.text.html.parser.DocumentParser.parse(Unknown
Source)
at javax.swing.text.html.parser.ParserDelegator.parse(Unknown
Source)
at javax.swing.text.html.HTMLEditorKit.read(Unknown Source)
at javax.swing.JEditorPane.setText(Unknown Source)
at
com.mindprod.canadiantax.CanadianTax.createComponents(CanadianTax.java:740)
at
com.mindprod.canadiantax.CanadianTax.init(CanadianTax.java:410)
at
sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown
Source)
at java.lang.Thread.run(Unknown Source)

Then I see a screen like this:
http://mindprod.com/image/screenshot/canadiantax2.png

This does not make sense. When init gets called, a new JEditorPane
gets created. So how does JEditorPane even know about the previous
incarnation?

I was able to discover all kinds of people who are also getting in
trouble with this bug. It is fairly old.

http://forums.oracle.com/forums/thread.jspa?messageID=8297744&tstart=0

Supposedly adding
JEditorPane.registerEditorKitForContentType("text/html",
"javax.swing.text.html.HTMLEditorKit");
fixes the problem, but I find it does not.

Roedy Green

unread,
Jan 24, 2011, 5:37:07 AM1/24/11
to
On Sat, 22 Jan 2011 14:30:50 -0500, "John B. Matthews"
<nos...@nospam.invalid> wrote, quoted or indirectly quoted someone who
said :

><http://i54.tinypic.com/16i5b1f.png>

Apple is not rendering &rsquo; properly. How long has Java been out?
And it STILL has blatant bugs like this??

John B. Matthews

unread,
Jan 24, 2011, 7:03:52 AM1/24/11
to
In article <0glqj6hop36lg5a31...@4ax.com>,
Roedy Green <see_w...@mindprod.com.invalid> wrote:

> On Sat, 22 Jan 2011 14:30:50 -0500, "John B. Matthews"
> <nos...@nospam.invalid> wrote, quoted or indirectly quoted someone who
> said :
>
> ><http://i54.tinypic.com/16i5b1f.png>

You're welcome.

Lew

unread,
Jan 24, 2011, 7:51:18 AM1/24/11
to
Roedy Green wrote:
> Apple is not rendering &rsquo; properly. How long has Java been out?
> And it STILL has blatant bugs like this??

That is not limited to Apple. I get the same effect in Google Chrome
7.0.517.41 beta on Ubuntu Linux 10.04.1 on an AMD-chip PC.

"... the buyer&rsquo;s home province ..." (mentioned upthread on 1/21)

RedGrittyBrick

unread,
Jan 24, 2011, 12:33:09 PM1/24/11
to

Obviously Chrome recognises that the possesive should be indicated with
&apos; :-)

--
RGB

Thomas A. Russ

unread,
Jan 24, 2011, 6:26:33 PM1/24/11
to
Roedy Green <see_w...@mindprod.com.invalid> writes:

> On Sat, 22 Jan 2011 14:30:50 -0500, "John B. Matthews"
> <nos...@nospam.invalid> wrote, quoted or indirectly quoted someone who
> said :
>
> ><http://i54.tinypic.com/16i5b1f.png>
>
> Apple is not rendering &rsquo; properly. How long has Java been out?
> And it STILL has blatant bugs like this??

JEditorPane (as of Java 1.6) only claims to support HTML3.2 and the
rsquo entity is an HTML 4 construct.

--
Thomas A. Russ, USC/Information Sciences Institute

Roedy Green

unread,
Jan 25, 2011, 9:33:18 AM1/25/11
to
On 24 Jan 2011 15:26:33 -0800, t...@sevak.isi.edu (Thomas A. Russ)

wrote, quoted or indirectly quoted someone who said :

>JEditorPane (as of Java 1.6) only claims to support HTML3.2 and the


>rsquo entity is an HTML 4 construct.

Yikes. HTML 4 came out in 1997. That was 98 dog years ago.
I guess that means you can't count on any CSS working either!
Java is running out of steam/money on the desktop.

I have used \u2019 instead of &rsquo;
I still have not found a workaround to the rendering bug. I will try
removing all CSS.

Daniele Futtorovic

unread,
Jan 25, 2011, 6:29:29 PM1/25/11
to
On 25/01/2011 15:33, Roedy Green allegedly wrote:
> On 24 Jan 2011 15:26:33 -0800, t...@sevak.isi.edu (Thomas A. Russ)
> wrote, quoted or indirectly quoted someone who said :
>
>> JEditorPane (as of Java 1.6) only claims to support HTML3.2 and the
>> rsquo entity is an HTML 4 construct.
>
> Yikes. HTML 4 came out in 1997. That was 98 dog years ago.
> I guess that means you can't count on any CSS working either!
> Java is running out of steam/money on the desktop.
>
> I have used \u2019 instead of&rsquo;
> I still have not found a workaround to the rendering bug. I will try
> removing all CSS.

But have you even been able to clearly identify the cases where it
doesn't work? As I said, it's fine on my box (WinXP, by the way). If
JEditorPane didn't support that entity, it shouldn't show up on my
screen, should it?

Roedy Green

unread,
Jan 25, 2011, 10:43:28 PM1/25/11
to
On Wed, 26 Jan 2011 00:29:29 +0100, Daniele Futtorovic
<da.fut...@laposte.net.invalid> wrote, quoted or indirectly quoted
someone who said :

>But have you even been able to clearly identify the cases where it

>doesn't work? As I said, it's fine on my box (WinXP, by the way). If
>JEditorPane didn't support that entity, it shouldn't show up on my
>screen, should it?

IIRC CSS and &rsquo; worked fine on my machine Windows 7 64-bit.
I have removed all entities from all my JEditorPanes in all my
programs. I have removed all style sheets and DOCTYPES, though there
is still a little embedded CSS left.

0 new messages