There are various alternatives:
Applet tag in browser
----------------------
Make your applet implement Runnable and put your code in a thread.
Avoid using the start and stop methods to do any real work.
Use the init method to start your thread.
Resizing the browser (even moving off the page) doesn't upset the applet
state (variable values, etc.)
Disadvantage: telling your applet when it needs to stop. Simply moving off
the page won't work and this may be a benefit in certain applications. But
most of the time you probably want your applet to stop when moving off the
page. Some kind of monitor needs to exist, some way of detecting the page
has been unloaded. This leads to other alternatives...
Applet in javascript
--------------------
Create an instance of your applet using javascript.
Use the body onload event to start it manually and use the unload event to
stop it maually.
The distinct advantage is you now stop it only when moving off the page.
Stopping it means setting an applet (boolean) member variable to false
alerting the applet thread to stop ( remember we are avoiding using the
stop() and start() methods which the browser bug calls when resizing)
Alternatively, I assume you can set the variable pointing to your applet
object to null and wait for the gc to collect the unreferenced applet
object.
The disadvantage of the javascript method is passing applet parameters. You
aren't using <param> tags so you have to overload your applet constructor to
accept parameters you will want to pass. Not a big deal, unless you are
using a third-party applet and can't modify the code.
Application-like applet using a Frame
--------------------------------------
You can use either of the above methods to generate the applet instance and
move the applet to a separate java.awt.Frame which you create either in
javascript or in your applet class. This separate the applet from the
browser, though you cannot close the browser without eradicating the Frame
and applet with it. You can use event listeners or other methods to exit
the Frame, calling its dispose() method and setting its reference variable
to null at that time
I have effective examples of all these methods and variations if you need
further suggestions.
rex henderson
"Rapido" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello all,
>
> I'm having a problem with an applet running under the Netscape browser
> (4.x). When the browser is resized the applet seemingly terminates and
> then re-starts. In this case a frame window, attached to the applet,
> closes and later (much later) re-appears after the applet has reloaded.
>
> Anyone know how to or where I can find info on how to deal with this
> sort of problem? Basically the applet should be left alone when the
> Navigator window resizes. Unfortunatley this is not the case.
>
> Any info is appreciated. Thx.
>
> Jose Negron