The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
January 2002

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Resizing Applets in Browsers

Posted by Matt Gerrans on January 18, 2002 at 4:12 PM

Hi Kishori,

This looks handy, but I don't follow how the JavaScript finds out the value from the applet for the "your new height/width goes here" settings. If the applet wants to change its size, how does it send a message to the JavaScript or browser?


> Place your OBJECT tags which has applet within a HTML form. Suppose your form name is form1. Also supply a name to your OBJECT tag. Suppose the OBJECT name is a1. Write a Javascript function and include this code to change the width or height of JApplet. (I have tested the following code)
> document.form1.a1.width = "your new width goes here"
> document.form1.a1.height = "your new height goes here"

> If you want to resize your applet using your mouse over the applet borders then you have to write Java code to do that. On mouse-move event check where the mouse pointer is. If the mouse pointer is on the border then start resizing the applet changing its width and height as required. You can also capture mouse-move event in Javascript and accomplish the same.

> Thanks
> Kishori





Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us