Resizing an applet when the browser is resized.
I have seen several posts on this topic in the archives, but haven't been able to get my applet to resize when the browser is resized.
Is there an official example on how to do this?
My applet is not the only element on the page. I tried setting the height and width to 100%, but this had no effect.
I have also copied a "resize" routine, which is executed by onLoad and onResize. This routine is getting executed, but the applet doesn't behave.
To get this method to work, I had to explicitly code the OBJECT tag in order to supply and ID that could be referenced by JavaScript, and I explicity set the MAYSCRIPT variable. I could not find out how to do this using the jsp:plugin tag.
No joy... my applet still doesn't respond, I am testing using IE 5.5.
Here is my code, note that I have tried several methods on the object:
<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.all.topologyApplet.resize(w_newWidth,w_newHeight);
document.all.topologyApplet.setSize(w_newWidth,w_newHeight);
//document.all.topologyApplet.sizeApp(100,100);
window.scroll(0,0);
}
window.onResize = resize;
window.onLoad = resize;
</SCRIPT>
<!-- START TOPO APPLET SECTION -->
<!-- <div id="topo" style="margin:10 0 10 0"> -->
<div id="topo" >
<table width="1000" border="0" cellspacing="0" cellpadding="3">
<tr>
<td >
<OBJECT id="topologyApplet"
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width="644" height="446"
codebase="http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#Version=1,2,2,0">
<PARAM name="java_code" value="com.topology.applet.TopologyApplet">
<PARAM name="java_archive" value="applet/topology.jar">
<PARAM name="type" value="application/x-java-applet;version=1.3">
<PARAM name="subnetName" value="<%=sname%>">
<PARAM name="jsessionid" value="<%=session.getId()%>">
<PARAM name="groupName" value="<%=gname%>">
<PARAM name = "scriptable" value = "true" >
<PARAM name="MAYSCRIPT" value="true">
<COMMENT>
<EMBED type="application/x-java-applet;version=1.3"
width="644" height="446"
pluginspage="http://java.sun.com/products/plugin/"
java_code="com.lane15.console.topology.applet.TopologyApplet"
java_archive="applet/topology.jar"
id="topologyApplet"
jsessionid="<%=session.getId()%>" subnetName="<%=sname%>" groupName="<%=gname%>"
>
<NOEMBED>
</COMMENT> Plugin not supported
</NOEMBED>
</EMBED>
</OBJECT>
</td>
</tr>
</table>

