Bambookit Home    Bambookit GUI Tutorial

Back    Next   

Chapter 3. Applet Tag



The first thing to understand about applets is how they are run from a web browser. Web browsers deal with HTML (HyperText Markup Language). There are HTML tags that say, "Set this text in bold" or "Break to a new paragraph", or "Run the Java applet that you will find in this .class file". Just as a GIF image file will be displayed at the point where its tag is in the HTML source, so the applet will be executed when its tag is encountered.

Those are the steps you have to take to create an applet:

  • Create an HTML document in an HTML editor of your choice(i.e. WordPad,Front Page,Dreamweaver...).
  • In the body of html file place your Bambookit Applet. The use of applet tags explained bellow.
  • Save the file. Place HTML document in the same directory where Bambookit jar file resides. Double-click on it to open it as a Web Page, or open it with your HTML editor to modify.

    The <APPLET> tag.

    Applet is added to the body of HTML page through the use of applet tags (<applet> as an opened tag and </applet> as a closed tag). Between the applet tags are param tags that specify the content and formatting for the applet.

    An example of the HTML code that invokes an applet is shown below:

    <applet archive="bamboo_b388.jar" code="Loader.class" width=400 height=400>
    <param name="background" value="e0d0a9">
    <param name="loadgui" value="button_url.xml">
    <param name="preload" value="images/mac.gif,images/windows.gif">
    </applet>



    An explanation of the attributes:

    archive, identifies the library that is required, in our case it will be the name of the jar file that you have purchased (i.e. bamboo.jar)
    code, is the bootstrap program that initializes the Bamboo applets, and you should always provide it as: code="Loader.class" in all your applets that you base on bambookit.
    param, the values with which we pass on to the bootstrap program.
    name, the name of the applet attribute, in our case a "background" with value set.
    name="loadgui" value="button_url.xml", that is the user interface that we would be loading into the browser, gui (graphical user interface) to load a file button_url.xml.
    name="preload" value="images/mac.gif,images/windows.gif" preload allows to load on the background the specified image while the home page is loaded and displayed. This allows to avoid problems associated with images when they took some time to download for display.
  • Back    Next