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

White rectangle flashing while Java applet is loading

9 views
Skip to first unread message

Gingko

unread,
Feb 6, 2006, 6:26:40 AM2/6/06
to
Hello,

I wrote a Java applet for an embedded application (which includes a tiny
HTTP server), and I have a problem with it, probably not related to the
embedded nature of the application.

The problem is, while the applet is loading, it displays a white rectangle
for a very short time before the applet becomes initialized (the applet is
drawn on a web page with a deep blue background).

This looks like very ugly, especially in Mozilla Firefox (version 1.5.0.1,
Window XP ...) because this rectangle shortly appears first near the left
margin of the page before being rendered centered on the page, as it is
normally expected.
(on Internet Explorer, there is also a white flashing rectangle, but it is
first drawn correctly centered).

I tried to set the background in the "init' function of the applet in
various ways, this makes the flashing a little shorter, but not enough to
makes it disappearing completely : the rectangle seems to be drawn largely
before the calling of the "init" function.

Does somebody know if there is some way to avoid this white rectangle, or at
least to delay it until the applet's rendering box is completely computed
after the loading of the embedding html web page ?

Thank you very much for any answer ...

Gingko


Roedy Green

unread,
Feb 6, 2006, 9:34:48 AM2/6/06
to
On Mon, 6 Feb 2006 12:26:40 +0100, "Gingko"
<nos...@temporaryrelay003.ath.cx> wrote, quoted or indirectly quoted
someone who said :

>Does somebody know if there is some way to avoid this white rectangle, or at
>least to delay it until the applet's rendering box is completely computed
>after the loading of the embedding html web page ?

see http://mindprod.com/jgloss/applet.html

search for the word "splash".
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Gingko

unread,
Feb 7, 2006, 11:56:24 AM2/7/06
to
----- Message d'origine -----
De : "Roedy Green" <my_email_is_post...@munged.invalid>
Groupes de discussion : comp.lang.java.programmer
Envoyé : lundi 6 février 2006 15:34
Objet : Re: White rectangle flashing while Java applet is loading


> see http://mindprod.com/jgloss/applet.html
>
> search for the word "splash".


Ok, thank you very much ....

I tried it, but unfortunately, it doesn't solve the problem :

Although this method can effectively replace the splash logo in Java 1.5+,
this logo appears only once the rendering box is entirely computed, so the
white flashing rectangle appearing at the wrong place in Mozilla Firefox is
still there ...

Gingko


Oliver Wong

unread,
Feb 8, 2006, 3:33:55 PM2/8/06
to

"Gingko" <nos...@temporaryrelay003.ath.cx> wrote in message
news:43e8d139$0$581$636a...@news.free.fr...

Sounds like a very difficult problem. If you know JavaScript, perhaps
you can have it communicate to the Java applet and ask it when the applet
has finished loading?

If you can do that, then you can use CSS to make the applet hidden, and
then use JavaScript to detect when the applet is loaded, and then change the
CSS to make the applet visible.

- Oliver


Roedy Green

unread,
Feb 8, 2006, 6:20:20 PM2/8/06
to
On Tue, 7 Feb 2006 17:56:24 +0100, "Gingko"

<nos...@temporaryrelay003.ath.cx> wrote, quoted or indirectly quoted
someone who said :

>Although this method can effectively replace the splash logo in Java 1.5+,

>this logo appears only once the rendering box is entirely computed, so the
>white flashing rectangle appearing at the wrong place in Mozilla Firefox is
>still there

Newsgroups are bad for his sort of thing. Someday you will be able to
show us a tiny movie clip of the problem.

Does this happen in other browsers or just Firefox?

Gingko

unread,
Feb 14, 2006, 7:06:01 PM2/14/06
to
Sorry for not answering sooner .... I have to work on several things at once
....

> Newsgroups are bad for his sort of thing.

Probably .... Do you know a better place for asking this question ?

> Someday you will be able to show us a tiny movie clip of the problem.

I could .... Unfortunately I had to work on something else, and I will not
be able to come back on this before next week ...

Also, I have to find some utility to make a movie about what happen on a
computer screen .... Unless using a digital video camera, but I am not sure
about the result ..

> Does this happen in other browsers or just Firefox?

I checked it only on Internet Explorer and Firefox so far.
The problem doesn"t seem to exist on Internet Explorer.

Gingko


Gingko

unread,
Feb 14, 2006, 7:20:22 PM2/14/06
to
> Sounds like a very difficult problem. If you know JavaScript, perhaps
> you can have it communicate to the Java applet and ask it when the applet
> has finished loading?
>
> If you can do that, then you can use CSS to make the applet hidden, and
> then use JavaScript to detect when the applet is loaded, and then change
> the CSS to make the applet visible.

I already tried to make the applet "hidden" using a CSS.
This doesn't prevent the flashing.
This white flashing rectangle seems to occurs out of the browser's control.

*But* I can use the CSS property "display:none"; in that case everything is
invisible .... no flashing rectangle ... but no rendering rectangle either
(it is like if I completely remove the "applet" tags).
I am a little afraid that trying to remove dynamically the "display:none"
attribute would give worst results again ...

Also, I need this applet to be burned in flash memory on an embedded device
(a little like the HTTP interface of modern network devices) along with the
embedding HTML page : I write it for a network device administration, not
for using it on Internet.
That means that I need a method that allows me to make as few code or HTML
pages as possible, because I have limited memory resources for recording all
of this. Every byte that I can save is very important.

Gingko


Oliver Wong

unread,
Feb 15, 2006, 9:51:02 AM2/15/06
to

"Gingko" <nos...@temporaryrelay003.ath.cx> wrote in message
news:dsts48$h39$1...@biggoron.nerim.net...

>> Sounds like a very difficult problem. If you know JavaScript, perhaps
>> you can have it communicate to the Java applet and ask it when the applet
>> has finished loading?
>>
>> If you can do that, then you can use CSS to make the applet hidden,
>> and then use JavaScript to detect when the applet is loaded, and then
>> change the CSS to make the applet visible.
>
> I already tried to make the applet "hidden" using a CSS.
> This doesn't prevent the flashing.
> This white flashing rectangle seems to occurs out of the browser's
> control.
>
> *But* I can use the CSS property "display:none"; in that case everything
> is invisible .... no flashing rectangle ... but no rendering rectangle
> either (it is like if I completely remove the "applet" tags).
> I am a little afraid that trying to remove dynamically the "display:none"
> attribute would give worst results again ...

Well... try it...

It's better than not delivering your product at all, right?

What you might be able to do, depending on how your browser's caching
work and what your applet does, is to pre-load the applet, but with
"display:none", so that it is invisible on one page, and then when the user
navigates to the page where the applet should be, it is already loaded, and
no white flashing will occur.

- Oliver

Gingko

unread,
Feb 16, 2006, 2:41:17 PM2/16/06
to
"Oliver Wong" <ow...@castortech.com> a écrit dans le message de news:
qdHIf.3050$_62.1633@edtnps90...

>
> "Gingko" <nos...@temporaryrelay003.ath.cx> wrote in message
> news:dsts48$h39$1...@biggoron.nerim.net...
>> *But* I can use the CSS property "display:none"; in that case everything
>> is invisible .... no flashing rectangle ... but no rendering rectangle
>> either (it is like if I completely remove the "applet" tags).
>> I am a little afraid that trying to remove dynamically the "display:none"
>> attribute would give worst results again ...
>
> Well... try it...
>
> It's better than not delivering your product at all, right?
>
> What you might be able to do, depending on how your browser's caching
> work and what your applet does, is to pre-load the applet, but with
> "display:none", so that it is invisible on one page, and then when the
> user navigates to the page where the applet should be, it is already
> loaded, and no white flashing will occur.
>
> - Oliver

I have some doubts .... I mean, even when I load another page after the
applet's one, and next I come back to the applet, I still have this "flash".
In the second display, at least, the applet is already expected to be in the
browser's cache.

Actually I can deliver the product like this, my employer is not that much
picky.

But as my applet has nothing particularly special (I was even trying to make
it compatible with the old Microsoft Java virtual machine), I supposed that
everybody who have created a rectangular applet horizontally centered on a
dark background should have met the same problem when displaying it in
Mozilla Firefox ... and because I have a quite moderate experience with Java
applets, I could have missed something that would have been obvious and very
well known for other developers !

Also, maybe I am too much picky myself about rendering?

Gingko


Oliver Wong

unread,
Feb 16, 2006, 4:57:12 PM2/16/06
to

"Gingko" <nos...@temporaryrelay003.ath.cx> wrote in message
news:dt2kgv$29uo$1...@biggoron.nerim.net...

>
> Actually I can deliver the product like this, my employer is not that much
> picky.
>
> But as my applet has nothing particularly special (I was even trying to
> make it compatible with the old Microsoft Java virtual machine), I
> supposed that everybody who have created a rectangular applet horizontally
> centered on a dark background should have met the same problem when
> displaying it in Mozilla Firefox ... and because I have a quite moderate
> experience with Java applets, I could have missed something that would
> have been obvious and very well known for other developers !
>
> Also, maybe I am too much picky myself about rendering?

Yes, probably.

I think most people writing applets just tolerate that brief white flash
as part of the applet loading process. It's not clear to me whether the
fault lies with Sun, or the browser design, or somewhere between the two.
For example, if the browser draws a white rectangle while waiting for its
plugin to load, then the problem is with the browser, and perhaps the
browser should draw nothing (i.e. a transparent rectangle) until the plugin
finishes loading.

Or maybe the browser requests the plugin to draw itself, but the plugin
hasn't finished loading the class files yet, so it draws a white rectangle
in response to the browser request, when maybe if should just not draw
anything.

- Oliver

0 new messages