Resize Applet Window

java packages » java.applet
Java Example Program/ Sample Source Code
Html Code
<html>
   <head>
   <title>Resize Applet Example </title>
   </head>
   <body bgcolor="#C6C3C6" onResize="resize()" onLoad="resize()" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
   <script language="JavaScript">
   function resize() {
    var w_newWidth,w_newHeight;
    var w_maxWidth=1600, w_maxHeight=1200;
    if (navigator.appName.indexOf("Microsoft") != -1)
    {
        w_newWidth=document.body.clientWidth;
        w_newHeight=document.body.clientHeight;
    }else{
        var netscapeScrollWidth=15;
        w_newWidth=window.innerWidth-netscapeScrollWidth;
        w_newHeight=window.innerHeight-netscapeScrollWidth;
    }
    if (w_newWidth>w_maxWidth)
        w_newWidth=w_maxWidth;
    if (w_newHeight>w_maxHeight)
        w_newHeight=w_maxHeight;
    document.ResizeAppletExample.setSize(w_newWidth,w_newHeight);
    window.scroll(0,0);
        }
   window.onResize = resize;
   window.onLoad = resize;
   </script>
   <applet name="ResizeAppletExample" code="ResizeAppletExample.class" width="700" height="500"/>
   </body>
   </html>

Applet


AppletContext

2011-2012 JavaExamples.org Privacy Policy Powered by Google App Engine