Java Forum / General / February 2006
White rectangle flashing while Java applet is loading
Gingko - 06 Feb 2006 11:25 GMT 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 - 06 Feb 2006 14:34 GMT On Mon, 6 Feb 2006 12:26:40 +0100, "Gingko" <nospam@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".
 Signature Canadian Mind Products, Roedy Green. http://mindprod.com Java custom programming, consulting and coaching.
Gingko - 07 Feb 2006 16:56 GMT ----- Message d'origine ----- De : "Roedy Green" <my_email_is_posted_on_my_website@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 - 08 Feb 2006 20:33 GMT > ----- Message d'origine ----- > De : "Roedy Green" <my_email_is_posted_on_my_website@munged.invalid> [quoted text clipped - 14 lines] > 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
Gingko - 15 Feb 2006 00:20 GMT > 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 [quoted text clipped - 3 lines] > 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 - 15 Feb 2006 14:51 GMT >> 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 [quoted text clipped - 14 lines] > 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 - 16 Feb 2006 19:41 GMT >> *But* I can use the CSS property "display:none"; in that case everything >> is invisible .... no flashing rectangle ... but no rendering rectangle [quoted text clipped - 13 lines] > > - 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 - 16 Feb 2006 21:57 GMT > Actually I can deliver the product like this, my employer is not that much > picky. [quoted text clipped - 8 lines] > > 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
Roedy Green - 08 Feb 2006 23:20 GMT On Tue, 7 Feb 2006 17:56:24 +0100, "Gingko" <nospam@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?
 Signature Canadian Mind Products, Roedy Green. http://mindprod.com Java custom programming, consulting and coaching.
Gingko - 15 Feb 2006 00:06 GMT 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
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|