Applet : Switching FullScreen on/off


               public void setFullScreen(boolean flag)
               {
                    // ... snip ...

                    this.requestFocus();
               }

:wink:

yes it already does, but for web security you cannot gain focus whenever you want within applet (same as in javascrit)

there could be a race condition involved since it works “most of the time” without refreshing the page.

you could try to delay the focus request a bit by putting it to the end of the EDT queue.

		    if(this.parent!=null)
		      	this.parent.add(this);
		    if(this.frame!=null)
		    	this.frame.dispose();
		    this.fullscreen=false;
		 }
	    this.setBounds(0,0,this.getParent().getSize().width,this.getParent().getSize().height);
	    
	    SwingUtils.invokeLater(new Runnable() {
public void run() {this.requestFocus();}
});

FocusListener added to the applet’s content pane with System.out.println() would help to debug further whether its a ignored requestFocus() issue or something else.

I have made some few modification and find something strange, it seems that I success (bt that was not really my goal… and it look more like a hack than a success but…) to switch pseudo-fullscreen without anykind of Java Alert message(at least with Java 1.6-07)

anyone can try it and tell me if they can see the “Window Applet Alert Message” or like…

=> also this version work with applet 1.1 except that the title bar is not removed

http://demo.dzzd.net/HelloWorld/HelloWorld.htm

It worked great here, firefox/vista32/Java1.6.13. I saw no security message and could toggle back and forth several times. The taskbar was not covered but the rest of the screen was.

thanks zoto, but no security message is normal, I was more wondering about the “window alert” that may be show in the bottom of the screen or as an exclamation icon (something that warn you that this is a Java window), but it seems that I was wrong when saying it does not appear, it seems to only be the case when trying it locally over internet there is a little banner at the bottom of the fullscreen window containing the text “Java window”.

do you have such icon exclamation or text banner when going into fullscreen ?

note that the first post source code is still the old one wich as a cupple of issue (as not working on older JVM), I will update with the new one ASAP

Worked mostly fine(or as you described :slight_smile: ) here, and no “window alert” but task-bar visible.

WinXP, java 1.6.13. FF 3, IE 7

Aside:
IE 7 (F5) cycled applet - fullscreen - applet - reload - fullscreen - applet - reload
FF F5 worked as toggle.
OutOfMemError killed it after a while

about the reload as you can guess this is normal … my stupidness… the key I have choosen to switch to fulscreen (F5) was not the best idea I could have…

[quote]FF .F5 worked as toggle
OutOfMemError killed it after a while
[/quote]
not sur I understand , sry … what do you mean ? did you get OutOfMemory after one or more than one switch , or does it dont work on FF ?