With applets, sometimes the browser acts as the applet's frame. This prevents the user from mistaking the browser window for a separate application and closing it. With this approach, the applet does not resize itself as the user resizes the browserbut there are ways to do this.
The HTML looks like this:
<TITLE>Resizable Applet Demo</TITLE>
<BODY bgcolor=#C6C3C6 onResize="resize()" onLoad="resize()"
topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
var w_maxWidth=1600, w_maxHeight=1200;
if (navigator.appName.indexOf("Microsoft") != -1)
window.onResize = resize;
window.onLoad = resize;
<APPLET NAME="myApplet" CODE="MyApplet.class" WIDTH=1800
Navigator and IE also have different methods of accessing the browser window's dimensions. In Navigator, the window object is referenced; in IE, the document's body object is used. These objects also return slightly different values for the window dimensions. Thus, it is necessary to determine the browser in which the applet is running before sending the correct window dimensions (see "Which Browser is Running Me?"). Netscape does not include the width of the scrollbars, and does not let you access this length, so 15 pixels are used as an offset in the netscapeScrollWidth variable.
public void setSize(int width, int height)