NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/

Easy Java Simulations (2001- ) => Questions related to EJS => Topic started by: lookang on August 10, 2011, 07:55:24 am



Title: can make ejs web java applet on click some button and full screen is shown?
Post by: lookang on August 10, 2011, 07:55:24 am
can make ejs web java applet on click some button and full screen is shown.
 
i think it is a useful feature for Ejs java web applets, to be able to go full screen.

i realized NTNUJAVA allows drag to new location on the screen but the size is unchanged. if it can go fullscreen it will be useful for
projecting on the screen in classroom settings.

for your consideration:)

i try to do it but no success, maybe this URL helps
http://alecjacobson.com/programs/fullscreen-applet/

and it works here
http://alecjacobson.com/programs/fullscreen-applet/?page=http%3A%2F%2Fwww.phy.ntnu.edu.tw%2Fntnujava%2Findex.php%3Ftopic%3D539.0&code=&codebase=&path=

alecjacobson.com shared his php code here
http://www.alecjacobson.com/weblog/?p=148
Code:
<?php
  $applet 
"";
  
$code "";
  if (isset(
$_GET['code'])&&strlen($_GET['code'])>0)
    
$code $_GET['code'];
  
# remove surrounding quotes if given any
  
$code preg_replace("/[\"\']$/","",$code);
  
$code preg_replace("/^[\"\']/","",$code);
  
# remove trailing .class just in case it's included
  
$code preg_replace("/\.class$/","",$code);
  
$codebase "";
  if (isset(
$_GET['codebase'])&&strlen($_GET['codebase'])>0)
    
$codebase $_GET['codebase'];
  
# remove surrounding quotes if given any
  
$codebase preg_replace("/[\"\']$/","",$codebase);
  
$codebase preg_replace("/^[\"\']/","",$codebase);
  
$path"";
  if (isset(
$_GET['path'])&&strlen($_GET['path'])>0)
    
$path $_GET['path'];
  if(empty(
$code)&&empty($codebase)&&!empty($path)){
    
# stip out basename to get just the code's name
    
$code = `basename $path`;
    
$code preg_replace("/\n$/","",$code);
    
# remove trailing .class just in case it's included
    
$code preg_replace("/\.class$/","",$code);
    if(empty(
$codebase)){
      
$codebase = `dirname $path`;
      
# make the codebase look like a directory, not neccessary for all browsers
      
$codebase preg_replace("/\n$/","/",$codebase);
    }
    
$applet "<applet width='100%' height='100%' code='$code' codebase='$codebase' ></applet>";
  }else if(!empty(
$code)&&!empty($codebase)){
    
# remove trailing .class just in case it's included
    
$applet "<applet width='100%' height='100%' code='$code' codebase='$codebase' ></applet>";
  }
?>


to go full screen, i just key in URL of webpage with applet http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=539.0 as an example

automatically it captures
Code: users.ntnu.fkh.twopointcharges_pkg.twopointchargesApplet.class
Codebase: http://www.phy.ntnu.edu.tw/ntnujava/ejsuser/2/
 
 


Title: Re: can make ejs web java applet on click some button and full screen is shown?
Post by: Fu-Kwun Hwang on August 10, 2011, 10:21:16 am
What you did is change the applet code so that the size of applet is adjustable according to the browser window size.
It is not really full screen.

I can add this feature to all the applets in the web site easily if you think it is useful.
(i.e. add a link to popup a resizable window  with only applet in the window).


Title: Re: can make ejs web java applet on click some button and full screen is shown?
Post by: lookang on August 10, 2011, 10:40:55 am
i do think it will be useful

1. to teachers in class using the simulations in the projector mode.
2. might be acceptable to Wikipedia external links http://en.wikipedia.org/wiki/Wikipedia:External_links which do not accept forums links, blog links, perhaps a full screen view is acceptable.
 
thanks!
it will be awesome when all NTNUJAVA applets can go almost full screen.
in most browser, when the key F11 is pressed, it will be even more full-screen :)


Title: Re: can make ejs web java applet on click some button and full screen is shown?
Post by: Fu-Kwun Hwang on August 10, 2011, 01:56:36 pm
It is done. You will find "full screen applet" link just below the applet.
Click the link and a new window will popup and the applet is sown in 100% browser size.


Title: Re: can make ejs web java applet on click some button and full screen is shown?
Post by: lookang on August 10, 2011, 02:49:37 pm
it is wonderful!
thanks again!  ;D