> Me again.
>
[quoted text clipped - 8 lines]
>
> Thanks!

Signature
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
>> About the start() and stop() function of the applet class, and tabs in
>> nowadays browsers.
>> Does anyone know if the stop function is called when you quit the current
>> page by selecting another tab (leaving the page with the applet open)? I
> You might try an experiment. Those are the best way to learn :-)
Well, this is what I have done, and so far the result is not satisfactory.
The start and stop methods are NOT called when you change the tabs in the
browser! Obviously, the programmers of the applets class did not expect the
browsers to have tabs.
I am sure that the stop/start methods are not called : I have put a null
pointer call in the stop() method of my application, and it does not crash.
I must say I am disapointed, I excpected better. So my games keep on working
(and the music and sounds keep on playing) when you change tabs in the
browsers. Too bad!
Francois
Qu0ll - 03 Dec 2007 20:15 GMT
> Well, this is what I have done, and so far the result is not satisfactory.
> The start and stop methods are NOT called when you change the tabs in the
[quoted text clipped - 7 lines]
> working (and the music and sounds keep on playing) when you change tabs in
> the browsers. Too bad!
Just a thought... have you tried playing with the applet.isVisible() method?
Maybe it will return false when the user goes to another tab in the browser.
If so, you could start a thread that checks it every 20 seconds or so and
takes the appropriate action.

Signature
And loving it,
-Q
_________________________________________________
Qu0llSixFour@gmail.com
(Replace the "SixFour" with numbers to email me)
Joe Attardi - 03 Dec 2007 20:35 GMT
> The start and stop methods are NOT called when you change the tabs in the
> browser! Obviously, the programmers of the applets class did not expect the
> browsers to have tabs.
I don't know. I could be wrong, but IMHO this is the correct behavior.
Switching to a different tab does not close the page being displayed.
Other embedded objects behave in the same way. Go to YouTube and start
playing a video that has sound. Switch to another tab, and notice that
the video keeps on playing.
For more details, check out the description of Applet.stop from the Java
SE 6 API documentation (emphasis mine):
"Called by the browser or applet viewer to inform this applet that it
should stop its execution. It is called ***when the Web page that
contains this applet has been replaced by another page***, and also just
before the applet is to be destroyed."
When you change to a different tab, the Web page containing the applet
has not been replaced by another page. Nor is the page closed (and its
contents destroyed).
Tim Smith - 04 Dec 2007 01:23 GMT
> Well, this is what I have done, and so far the result is not satisfactory.
> The start and stop methods are NOT called when you change the tabs in the
> browser! Obviously, the programmers of the applets class did not expect the
> browsers to have tabs.
You should probably also test with different browsers. Applets are an
area where it is Write Once Debug Everwhere. :-)
Andrew Thompson - 04 Dec 2007 01:35 GMT
>> Well, this is what I have done, and so far the result is not satisfactory.
>> The start and stop methods are NOT called when you change the tabs in the
>> browser! Obviously, the programmers of the applets class did not expect the
>> browsers to have tabs.
>
>You should probably also test with different browsers. ...
Ideed. I whince whenever I see someone mention 'the browser'
when it comes to applet problems. There is no such thing.
Every browser has its quirks, and each one has different quirks,
and different quirks in different versions.
>...Applets are an
>area where it is Write Once Debug Everwhere. :-)
Yeah.. that's what I keep telling them, but it's good to
hear somebody else say it - maybe it'll finally sink in. ;-)

Signature
Andrew Thompson
http://www.physci.org/