Friday, March 21, 2025

So, You Want Advanced Applets, Huh?


Use these to jump around or read it all…


[Why This Tutorial?]

[The Code]

[What Does It All Mean?]

[More Applet Commands]

[PARAM NAME]

[What You Need]

[Where Do I Get These Items?]

[Where Can I Find More Applets?]

[Final Thoughts]





Why This Tutorial?

     I have a couple tutorials up on Java Applets. Neither of them are very difficult. I did that on purpose as Applets can be confusing. This tutorial is meant to go beyond. I intend to cover all aspects of Applets not covered in my other tutorials in this tutorial. In order to do that, I went out to find a long, very involved applet. The one below meets my criteria. It’s long, involved, brings together two images, two Applets, one HTML document, and offers a great deal of configuration possibilities.

     The applet was written by Ashley Cheng who made it available for free downloading at The Java Boutique. I will be sending you there to grab the applet items at the end of this tutorial. If you can get this applet to run, you can get any applet to run!

     Click on the scrolling words and watch the text at the bottom of your browser screen.






The Code


     This is the code that will appear on your HTML document. It calls for and configures the applet. You can copy and paste it from here when you get started on this yourself. For now, look at the code and I’ll explain what each part means afterward.




<APPLET CODEBASE=classes CODE=”Ashleyticker.class”
WIDTH=220 HEIGHT=31>
<PARAM NAME=typeface VALUE=”Courier”>
<PARAM NAME=mouseup VALUE=”That’s much better”>
<PARAM NAME=mousedown VALUE=”Get your hand off me”>
<PARAM NAME=mouseleft
VALUE=”Hey, I haven’t finished yet!”>
<PARAM NAME=mouseright VALUE=”What’s the matter?”>
<PARAM NAME=mouseoutb VALUE=”Please”>
<PARAM NAME=fontsize VALUE=14>
<PARAM NAME=image VALUE=”images/panel2.gif”>
<PARAM NAME=imborder VALUE=”images/panelb.gif”>
<PARAM NAME=style VALUE=0>
<PARAM NAME=sensitive VALUE=10>
<PARAM NAME=step VALUE=6>
<PARAM NAME=offset VALUE=1>
<PARAM NAME=text VALUE=255,255,0>
<PARAM NAME=shadow VALUE=200,100,20>
<PARAM NAME=backgd VALUE=0,0,0>
<PARAM NAME=count VALUE=3>
<PARAM NAME=repeat VALUE=3>
<PARAM NAME=message0
VALUE=”Welcome to Advanced Applets.”>
<PARAM NAME=message1
VALUE=”Stick around, I will show you how
to do this.”>
<PARAM NAME=message2 VALUE=”It is not that rough.”>
</APPLET>



What Does It All Mean?


     I’ll start from the top:


  • APPLET denotes to the browser an applet is starting here.

  • CODEBASE tells the browser in which directory to find all the Applets. These Applets happen to be in a directory called CODEBASE. If the Applets are in the same directory as the page, this command is not needed.
  • CODE denotes to the browser what applet will be used.
  • HEIGHT & WIDTH denote the “window” the applet will perform within. This is required and is set. Altering these numbers can stop the entire process.

    The exception to this rule is when you have an applet that
    uses a graphic. If you change the graphic, you also must change the HEIGHT and WIDTH to equal the new graphic.

  • PARAM NAME is short for parameter name. This is a
    parameter set up in the applet itself. These are applet-specific commands. Just because a PARAM NAME works with one applet in no way assures it will work in another. This applet requires many parameter names. I will get into them in a moment.
  • VALUE denotes what will be the actual parameter.
  • /APPLET ends the whole deal.





More Applet Commands


     These are extra items that can go inside the <APPLET> command above, just like the CODE and the HEIGHT items.


  • ALIGN= This tells the text around the applet what to do. I don’t have text surrounding mine so I didn’t see a need to use it. Play with “top,” “middle,” and “bottom.”
  • ALT= This denotes what will be written in Java-ready browsers when the in-line images are turned off.
  • HSPACE= Denotes left and right margins on Applets. Use pixels.
  • VSPACE= Ditto, except top and bottom margins.





The PARAM NAME Configurations

     If it appears to you that you can alter the parameter values, you’re right, you can. You’re so smart! Here are the parameters and what you can do with them. Just make sure to keep the quotation marks.

<PARAM NAME=typeface VALUE=”Courier”>

     I’m not sure how many different
fonts this will support. Try a few by changing the Courier to
something else.

<PARAM NAME=mouseup VALUE=”That’s much better”>

     This is what is printed along the bottom when the mouse is let up after a click. The following four are self-explanatory. Fill in what you’d like the bottom of the screen to say. Let’s not get dirty here.


<PARAM NAME=mousedown VALUE=”Get your hand off me”>

<PARAM NAME=mouseleft VALUE=”Hey, I haven’t finished
yet!”>

<PARAM NAME=mouseright VALUE=”What’s the matter?”>

<PARAM NAME=mouseoutb VALUE=”Please”>

<PARAM NAME=fontsize VALUE=14>


     Change the font value in # of
points.

<PARAM NAME=image VALUE=”images/panel2.gif”>

<PARAM NAME=imborder VALUE=”images/panelb.gif”>


     These are the two images that are imported to create the panel that the text rolls across. I wouldn’t mess with this too much. If you do, though, make sure to change the HEIGHT and WIDTH in the APPLET command to reflect the size of your new image.


<PARAM NAME=style VALUE=0>

<PARAM NAME=sensitive VALUE=10>


     These deal with the look and
feel from the mouse. I found no differences in changing the
numbers.

<PARAM NAME=step VALUE=6>

     This is the speed at which the text scrolls past. Lower numbers go slower.

<PARAM NAME=text VALUE=255,255,0>

<PARAM NAME=shadow VALUE=200,100,20>

<PARAM NAME=backgd VALUE=0,0,0>


     These all deal with the colors of the text, shadow, and background. Note they are hex codes, but are written separating the three sections by commas. The applet follows this format — so must you.

<PARAM NAME=count VALUE=3>

<PARAM NAME=repeat VALUE=3>


     Each of these deal with how many times the items will scroll. Higher numbers go longer.

<PARAM NAME=message0 VALUE=”Welcome to Advanced
Applets.”>


<PARAM NAME=message1 VALUE=”Stick around, I will show you how to do this.”>

<PARAM NAME=message2 VALUE=”It is not that rough.”>


     These are the three lines of text that scroll across the applet face. Change to your heart’s content.





What You Need


     You will require five items to make this work:



  1. An HTML document with APPLET code (You can get that right here)
  2. Ashleyticker.class (an applet)
  3. NoFlickerApplet.class (an applet)
  4. panel2.gif (background image)
  5. panelb.gif (top and bottom line images)



Make Very Sure:

     You download the Applets as “ALL FILES”

     You download the IMAGES as “BINARY” or “ALL FILES”

–If you download any of these items in the wrong format, they will be corrupted and will not work.



Where Do I Get These Items?


     I’m not offering these from my
site. I want you to go to the Java Boutique and grab these items for yourself. (I told you this was an advanced deal.) You will find the applet above here:



http://www.javaboutique.internet.com/Ashleyticker/


Make sure you grab all the parts…





Where Can I Find More Applets?


     Any one of these — go nuts.



[The Java Boutique]
[Sun Microsystems Java]

[TeamJava] [Netscape’s Java Applets Page]

[Yahoo’s Java Directory]

Final Thoughts

     There are hundreds of Applets out there that people are offering for free. They are being so nice that there really isn’t any need to steal an applet from someone’s page. If you look hard enough, you’re going to find a freeware applet that will suit your needs.

     If not, please make a point of
asking the person if you can use their applet. If they say no, that’s their right. You may have to go and find another applet to use in a little different manner.

     If you get this applet to work,
you can get any applet to work. Just follow the same format for placing another on your page. And please make sure to download and FTP in the correct formats. If you try this applet and it doesn’t work, the smart money is you didn’t transfer the information in the correct format and have corrupted it somewhere along the way.


[Why This Tutorial?]

[The Code]

[What Does It All Mean?]

[More Applet Commands]

[PARAM NAME]

[What You Need]

[Where Do I Get These Items?]

[Where Can I Find More Applets?]

[Final Thoughts]

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Popular Articles

Featured