DzzD
|
 |
«
Posted
2009-03-09 18:23:26 » |
|
use F5 to toggle fullscreen on/off http://demo.dzzd.net/HelloWorld/HelloWorld.htmcode to put in the Applet to switch full screen EDIT :copy / paste the below code in your applet and call switchFullScreen from where you want in your applet to switch fullscreen 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| Frame frame = new Frame(); Container parent; boolean fullscreen=false; public void switchFullScreen() { System.out.println("SWITCH"); if(!fullscreen) { if(this.parent==null) this.parent=getParent(); frame.setUndecorated(true); frame.add(this); frame.setVisible(true); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] devices = ge.getScreenDevices(); devices[0].setFullScreenWindow(frame); fullscreen=true; } else { parent.add(this); frame.dispose(); fullscreen=false; } this.requestFocus(); } |
|
|
|
|
kevglass
|
 |
«
Reply #1 - Posted
2009-03-09 18:30:53 » |
|
Doesn't go fullscreen here. Big window, fills the screen apart from the task bar is still visible.
Windows XP.
Kev
|
|
|
|
DzzD
|
 |
«
Reply #2 - Posted
2009-03-09 18:35:43 » |
|
Doesn't go fullscreen here. Big window, fills the screen apart from the task bar is still visible.
Windows XP.
Kev
yes in fact it is not true exclusive fullscreen, so if you have your taskbar option set as "keep taskbar over other window" it will stay visible, you should also see the java warning wich is a good thing
|
|
|
|
Games published by our own members! Check 'em out!
|
|
Abuse
|
 |
«
Reply #3 - Posted
2009-03-09 19:09:01 » |
|
If you go fullscreen in the browser (F11), then 'full screen' in the Applet actually reduces visible screen area! (browser fullscreen mode goes over the top of the taskbar)
|
|
|
|
Riven
|
 |
«
Reply #4 - Posted
2009-03-09 19:15:51 » |
|
In Opera (on Vista x64) it only works 1 time...
F5 -> big window (not fullscreen though) F5 -> applet with cube F5 -> white applet F5 -> applet with cube F5 -> white applet etc
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings!
|
|
|
DzzD
|
 |
«
Reply #5 - Posted
2009-03-09 19:16:41 » |
|
If you go fullscreen in the browser (F11), then 'full screen' in the Applet actually reduces visible screen area! (browser fullscreen mode goes over the top of the taskbar)
probably office task bar will too, yup dont know if it is really a big problem ? I am more worry about the below bug  doesn't work for me.. I get a big window, but it doesn't cover the entire screen. It's like it's been offset to the screen coordinates of the original applet.
OS / Java Version / browser ? it look like another plugin bug
|
|
|
|
DzzD
|
 |
«
Reply #6 - Posted
2009-03-09 19:18:42 » |
|
In Opera (on Vista x64) it only works 1 time...
F5 -> big window (not fullscreen though) F5 -> applet with cube F5 -> white applet F5 -> applet with cube F5 -> white applet etc
peraps that is because vista is made to be used only once  ?
|
|
|
|
Riven
|
 |
«
Reply #7 - Posted
2009-03-09 19:24:34 » |
|
Good point.
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings!
|
|
|
Riven
|
 |
«
Reply #8 - Posted
2009-03-09 19:27:48 » |
|
In MSIE7 (on Vista x64) it only works in ODD attempts... F5 -> big window (not fullscreen though) F5 -> applet with cube F5 -> white applet F5 -> applet with cube F5 -> big window (not fullscreen though) F5 -> applet with cube F5 -> white applet F5 -> applet with cube F5 -> big window (not fullscreen though) etc 
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings!
|
|
|
DzzD
|
 |
«
Reply #9 - Posted
2009-03-09 19:34:46 » |
|
In MSIE7 (on Vista x64) it only works in ODD attempts... F5 -> big window (not fullscreen though) F5 -> applet with cube F5 -> white applet F5 -> applet with cube F5 -> big window (not fullscreen though) F5 -> applet with cube F5 -> white applet F5 -> applet with cube F5 -> big window (not fullscreen though) etc  anyway it is pretty regular  maybe the refresh IE F5 key doesn't help, maybe switching by clicking on a nice fullscreen icon at the corner of the applet will work better (for focus). big window (not fullscreen though) how big ?
|
|
|
|
Games published by our own members! Check 'em out!
|
|
Riven
|
 |
«
Reply #10 - Posted
2009-03-09 19:43:44 » |
|
Everything but the taskbar, so even the sidebar is obscured, normal maximized windows do not overlap the sidebar.
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings!
|
|
|
bienator
Senior Devvie   
OutOfCoffeeException
|
 |
«
Reply #11 - Posted
2009-03-09 20:10:36 » |
|
works on ubuntu with 6u14b02. I am curious, why have you chosen the refresh button as fullscreen switch (to workaround a bug)? I have to refocus the applet each time after restoring from fullscreen to avoid page reloads.
|
|
|
|
DzzD
|
 |
«
Reply #12 - Posted
2009-03-09 20:15:09 » |
|
I did not really choose anything this was a popup code written today in around 5 minutes, there are still some bug but I am sure it can be usefull. just a sample that can be improved.
EDIT : to use it you only need to copy paste the above code into your applet and call switchFullScreen when you want to switch your appelt to fullscreen. like onkepress(){if... switchFullScreen )
|
|
|
|
Ranger
|
 |
«
Reply #13 - Posted
2009-03-09 20:58:39 » |
|
Cool! Worked on Firefox + Chrome on Vista 32bit. Had problems on MSIE, but I thinks that's because IE was intercepting the F5 key and trying to do a refresh. Thanks for the code. 
|
|
|
|
DzzD
|
 |
«
Reply #14 - Posted
2009-03-09 22:19:25 » |
|
improved version : some little improvment as applet autoresize : http://demo.dzzd.net/HelloWorld/HelloWorld.htm1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| private Frame frame ; private Container parent; private boolean fullscreen=false;
public void setFullScreen(boolean flag) { if(flag && this.fullscreen) return; if(flag) { if(this.parent==null) this.parent=getParent(); this.frame= new Frame(); this.frame.setUndecorated(true); this.frame.add(this); this.frame.setVisible(true); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] devices = ge.getScreenDevices(); devices[0].setFullScreenWindow(this.frame); this.fullscreen=true; } else { 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); this.requestFocus(); } |
|
|
|
|
Ranger
|
 |
«
Reply #15 - Posted
2009-03-09 23:21:34 » |
|
Not sure why, but in IE, the requestFocus doesn't seem to be working when exiting from full screen mode.
|
|
|
|
Riven
|
 |
«
Reply #16 - Posted
2009-03-09 23:32:14 » |
|
Just replace F5 by SPACE, or anything else because every browser refreshes the page on F5, the moment the applet loses focus. It makes testing this code very unintuitive.
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings!
|
|
|
Ranger
|
 |
«
Reply #17 - Posted
2009-03-09 23:53:50 » |
|
Just replace F5 by SPACE, or anything else because every browser refreshes the page on F5, the moment the applet loses focus. It makes testing this code very unintuitive.
True, however, the Applet shouldn't lose focus when switching between full screen (AKA "Maximised Window") and back, as if it does, you'll also get issues with F1, F11, Backspace, ...
|
|
|
|
DzzD
|
 |
«
Reply #18 - Posted
2009-03-10 01:01:13 » |
|
maybe the best would be an icon to click
|
|
|
|
princec
|
 |
«
Reply #19 - Posted
2009-03-10 11:21:43 » |
|
Can't it post a request focus? Cas 
|
|
|
|
Riven
|
 |
«
Reply #20 - Posted
2009-03-10 14:51:40 » |
|
Can't it post a request focus? Cas  1 2 3 4 5 6
| public void setFullScreen(boolean flag) {
this.requestFocus(); } |

|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings!
|
|
|
DzzD
|
 |
«
Reply #21 - Posted
2009-03-10 15:33:33 » |
|
yes it already does, but for web security you cannot gain focus whenever you want within applet (same as in javascrit)
|
|
|
|
bienator
Senior Devvie   
OutOfCoffeeException
|
 |
«
Reply #22 - Posted
2009-03-10 16:32:23 » |
|
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. 1 2 3 4 5 6 7 8 9 10 11
| 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.
|
|
|
|
DzzD
|
 |
«
Reply #23 - Posted
2009-06-30 04:03:03 » |
|
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
|
|
|
|
zoto
|
 |
«
Reply #24 - Posted
2009-06-30 09:53:52 » |
|
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.
|
|
|
|
DzzD
|
 |
«
Reply #25 - Posted
2009-06-30 10:08:42 » |
|
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
|
|
|
|
jojoh
|
 |
«
Reply #26 - Posted
2009-06-30 10:44:41 » |
|
Worked mostly fine(or as you described  ) 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
|
|
|
|
DzzD
|
 |
«
Reply #27 - Posted
2009-06-30 10:54:00 » |
|
Worked mostly fine(or as you described  ) 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... FF .F5 worked as toggle OutOfMemError killed it after a while 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 ?
|
|
|
|
|