[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Width and height of java applet

Posted on 2007-11-29
5
Medium Priority
?
1,472 Views
Last Modified: 2012-06-27
Hi,

When I embed a java applet into a webpage, I use:

    <applet code=whatever.class width=402 height=402>

Inside the java applet class, I can get the bounds by doing:

    bounds().width;
    bounds().height;

Is there anyway to override the size of the applet as rendered in the html page? I mean if in my applet class, I want my applet to really be 500 x 500, can I do something like:

    bounds().setNewWidth(500);

or is it just static after you've loaded the page and you're stuck?

Thanks
0
Comment
Question by:DJ_AM_Juicebox
  • 2
  • 2
5 Comments
 
LVL 8

Expert Comment

by:malfunction84
ID: 20375940
The browser determines the size of embedded elements, including applets.  If you did want to change the size, you'd have to do it external to the applet, in the HTML itself.

I doubt very much that DHTML (Javascript, etc) would work, but if your HTML is generated by PHP, JSP, ASP, etc., it can be done by generating HTML with different height and width attributes for the applet element.
0
 
LVL 5

Accepted Solution

by:
ebertk earned 2000 total points
ID: 20376783
Nope, you are stuck.  You can, however, create an additional panel inside the applet and change the size of that panel.  To the HTML page you would still have the same sized applet, but the applet itself could be drawn in the small space.

You can, in fact, use javascript to create the Java applet section of your HTML document and then use the javascript to control the size you with to appear.  The key to making this work is to make sure you use javascript to generate the entire applet tag and all of its parts.  If you try to use javascript to only change the height and width attributes it won't work.

Good luck!
0
 
LVL 92

Expert Comment

by:objects
ID: 20377887
you can use javascript to resize the applet
0
 
LVL 5

Expert Comment

by:ebertk
ID: 20379648
Objects - assume!  Had no idea.  Links were great.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This article discusses how to create an extensible mechanism for linked drop downs.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month19 days, 9 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question