White rectangle flashing while Java applet is loading

G

Gingko

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
 
G

Gingko

----- Message d'origine -----
De : "Roedy Green" <[email protected]>
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



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
 
O

Oliver Wong

Gingko said:
----- Message d'origine -----
De : "Roedy Green" <[email protected]>
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




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 ...

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
 
R

Roedy Green

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?
 
G

Gingko

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
 
G

Gingko

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
 
O

Oliver Wong

Gingko said:
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
 
G

Gingko

Oliver Wong said:
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
 
O

Oliver Wong

Gingko said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top