getting rid of a white flash while applet is loading

J

Jill Singer

hello-

I've looked through the archives, searched the web, and been
working on this all week-

any ideas how to get rid of the white flash that occurs (in ie) as
an applet is loading?

I've tried to hide the applet container: first by hiding the div (it
did not work, merely delayed the white flash--hai tried the same
approach with the same results)
second by covering it up with a floating div -- this
time, the applet did not display at all; there was just a black screen
where the applet should have been.

one thought is that when I set the image param of the applet, is that
it can't find the black.gif file; another thought is to use an applet
loader (load the applet within another applet); but the only code
examples that I can find:
a) don't work
or
b) are under the gpl so I can't use them (i work at a for-profit
company that has closed source, and I do enjoy getting paid...)

thanks for your help

(ps: I did find this post, but it doesn't have any conclusive answers
on it:
http://groups.google.com/group/comp...q=applet+loading+white+flash#456fb7f20ccc2b5d
)
 
J

John B. Matthews

[...]
any ideas how to get rid of the white flash that occurs (in ie) as an
applet is loading?
[...]

This article mentions the problem in connection with JApplet:

<http://java.sun.com/docs/books/tutorial/deployment/applet/gui.html>

An Applet can exaggerate the effect by doing complex drawing. It might
help to simply set the background color the first time through and do
the rest on the next repaint. In this contrived example, you can see
that the browser page isn't updated until paint() completes:

<code>
import java.applet.*;
import java.awt.*;

public class Hello extends Applet {
public void paint(Graphics g) {
g.setColor(Color.gray);
// busy, busy
for (int y = 0; y <= getHeight(); y++)
for (int x = 0; x <= getWidth(); x++)
g.fillRect(0, 0, x, y);
g.setColor(Color.black);
g.drawString("Hello World!", 50, 75);
}
}
</code>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html">
<title>Hello</title>
</head>
<body bgcolor="#404040">
<applet code="Hello.class" width=400 height=150></applet>
</body>
</html>
 
A

Andrew Thompson

[...]> any ideas how to get rid of the white flash that occurs (in ie) as an
applet is loading?
....
An Applet can exaggerate the effect by doing complex drawing. It might
help to simply set the background color the first time through and do
the rest on the next repaint.

Clever solution. Other ways to attack the problem might be to
- use the same technique in a tiny applet that loads the main applet.
- specify a BG color for applets in the HTML/CSS (though that is
untested, and as soon as the runtime takes control, it would probably
result in the same problem).

Of course, I would tend to launch the applet using webstart, in which
case the entire problem disappears. Using webstart, we can even
specify
a 'splash image' to use while loading/updating.
 
J

Jill Singer

I've been trying to launch the applet from another applet, but the
main applet is very complicated and uses *lots* of threads (i did not
write it), and so that isn't working;
also- we're using jdk1.5 (the new viewer uses 1.6, it's not released
to the public yet)

so, is it possible to use web start with 1.5? I found this example:
http://java.sun.com/javase/6/webnotes/deploy/applet-migration.html
and haven't had any success with it; even with a very simple applet.

do you have any examples of how to use the appletviewer in java web
start? I've been searching the web without much results.

thanks!

-Jill

(The applet is too complex to try the paint later approach,
unfortunately)
 
J

John B. Matthews

Of course, I would tend to launch the applet using webstart, in
which case the entire problem disappears.  Using webstart, we can
even specify a 'splash image' to use while loading/updating.
[...]
so is it possible to use web start with 1.5?
[...]

Yes. Here's a minimal example; depending on your browser, you may have
to right-click on the launch link to see the .jnlp file instead of
launching the JWS application:

<http://sites.google.com/site/drjohnbmatthews/composite>

Andrew Thompson has more advanced information on this topic:

<http://pscode.org/jws/>

[Please do not top-post:
<http://www.catb.org/jargon/html/T/top-post.html>]
 

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,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top