Sign in to follow this  

Java+JavaScript

This topic is 4862 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Anyone know if it is possible to use the DOM in javascript to change the size of a Java Applet dynamically? I've tried giving a name to the applet inside of the tag like: <applet name="SomeApplet" height=0 width=0></applet> And then trying to change it in javascript such as: document.layers["SomeApplet"].height = 100; document.layers["SomeApplet"].width = 100; But it returns an error saying document.layers.SomeApplet is null or not an object. So anyone know if there is a way to do this? Why would I want to do this? Well basically, change the size of an applet without reloading the page or the applet itself.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I suspect APPLET objects lie outside the DOM.

Might I suggest you take a look at Java WebStart instead? You still distribute your application via a website, but it opens in a new top-level window instead. You can resize the window as much as you like then, and the user can even close the browser and leave your application running.

WebStart HOW-TO:
http://wiki.java.net/bin/view/Games/HowToUseWebstart

Examples:
http://grexengine.com/sections/externalgames/tech-page-Webstart.html

--cfmdobbie

Share this post


Link to post
Share on other sites
Forget document.layers, that sounds like something out of Netscape4 DOM.

You MIGHT be able to do it using the proper dom functions, by manipulating the style of the applet (or object) element (Hint: use document.getElementById and then manipulate the style.width and height properties)

But don't hold your breath; Java applets aren't designed to be resized, so it might not work. Or it might just move around other elements on the page while leaving the applet the same size.

The same probably goes for Flash.

Mark

Share this post


Link to post
Share on other sites

This topic is 4862 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this