?
Solved

Width and height of java applet

Posted on 2007-11-29
5
Medium Priority
?
1,467 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

Find out what you should include to make the best professional email signature for your organization.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses
Course of the Month13 days, 23 hours left to enroll

800 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