Discussion Locked

resizing an applet window (within a HTML

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
using the applet tages for a java applet i defined an applet window with width and height, expecting to be able to resize those numbers from within the applet, however this was not the case. Neither the resize(x,y) nor the setSize(x,y) methods wouldresize the gray area designated by the browser to run the applet, rather it would only limit the area on that window that I was able to draw to the screen. Is there anyway to properly resize this applet window from within the applet?? thanks so much:-)

5 replies

by flan

once you've set the size of an applet it's pretty much stuck that way, cuz it'll load what ever the inital dimensions are. maybe if you have the previous page (which calls the applet function) to have a user interface where the user can define parameters of the applet, and just resize it from there that would work, (but you'd just be opening another applet, not using the same one over.

or you create an applet with canvas. basically have a one big applet window and have a paintable area in the applet. sort of like an applet in an applet

by keith.hall1

I know your asking if you can resize it from within the applet, and as the previous correspondent wrote, thats impossible as far as I know. The best workaround would be to call the function to resize applet from within Javascript within your browserif your page is set up to do that, e.g. applet has an id=myApplet, and you have a public function within the applet called appletResize(int x ,int y) then use a Javascript function
setAppletSize(x,y){
document.myApplet.appletResize(x,y);
document.myApplet.width=x;
document.myApplet.height=y;
}
somewhere in your HTML.

Regards

Keith Hall

This discussion is closed to new replies.