Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

Monday, November 19, 2007

java applet HTML tag

You need to specify the following values in an applet tag.

  • Size. width="nn" height="mm", where nn and mm are the width and the height of the area the applet will occupy on the web page. Applets are not resizeable (except when run with the appletviewer application, but if you're using appletviewer, why are you writing an applet? Specifying the size is a nasty problem. Because applets can be run on web pages in many different environments, you don't know the pixel exact dimentions of the particular widgets, so you have to estimate the largest size that will be required and specify that in your applet tag. I often add System.out.println to print that applet size (use getSize()), then add a little.\ I hope you are using a layout that will expand gracefully.
  • Class file location. There are several possibities.
    Simple class files
    Specify code="Xxxx.class"
    Jar file
    If you're using packages (eg, with NetBeans), you will need to specify the .jar file as an archive and then give the class which contains the applet, qualified by the package name. Specify code="yourPackage.Xxxx.class" archive="yourPackage.jar"

Example tag

This applet tag can be used to display the above applet.

                                                               height="20">

No comments:

Post a Comment

Archives