Explorer Listener

Hi,

I have an applet running inside default browser, how i can understand that the browser is minimized to the taskbar (or maximized) ?

Message was edited by:

acartamersoy

[197 byte] By [acartamersoya] at [2007-11-27 11:43:27]
# 1

You can't, generally.

You can get the parent Frame of the applet with one of the SwingUtilities methods, and add a window listener to it. That will give activated/deactivated events when the applet gains/loses focus, including when minimized/restored if the applet has focus when that happens.

I know of no way to know what the browser is doing otherwise.

bsampieria at 2007-7-29 17:50:04 > top of Java-index,Java Essentials,New To Java...
# 2

Could JavaScript detect this?

BigDaddyLoveHandlesa at 2007-7-29 17:50:04 > top of Java-index,Java Essentials,New To Java...
# 3

At one point in history, the applet's stop method was usable for this purpose. However, that has changed and the stop method no longer is invoked when the browser page that contains the applet is minimized.

See this bug report:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6253159

ChuckBinga at 2007-7-29 17:50:04 > top of Java-index,Java Essentials,New To Java...
# 4

Javascript, I think only universally has onBlur/onFocus methods.

Specific browsers may have custom choices, but I'm not sure what they are off-hand.

Applet.stop() was also supposed to be for leaving the page... at least initially that's why I remember. Then start if you browse back to the page. I don't believe it does that either anymore. I think stop() and destroy() are both called leaving the page.

bsampieria at 2007-7-29 17:50:04 > top of Java-index,Java Essentials,New To Java...