Home Applet Index SlideShows Nova Applets JavaScript Perl Software Purchase
Hot Tools
PopUp Maker code generator, CodeLifter page-code ripper, Scrollbar Styler, more... tons of *free* JavaScript!
Click Here!
Help: Java: Tips & Techniques
Using E-Mail Addresses in Java Links

You can indeed use E-Mail addresses in Java applet link parameters in most cases.  The name of the parameter for the link may differ from applet to applet, but the value = will look like this:

<PARAM NAME = "Link" VALUE = "mailto:Someone@Somewhere.com">

The temptation is to use slashes or quotation marks within the address -- but there are none.  Stay to form, exactly as shown.

The "target" for a mailto should normally be _top.  Setting it to _new or some other value will often have the undesired side effect of opening a new, empty browser window along with the mail client.

You can also force text to the subject line of most e-mail clients by configuring the value= thus:

VALUE = "mailto:Someone@Somewhere.com?subject=My Huge Feet"

Spaces in the subject text are permitted, but avoid the temptation to put quotation marks around the subject text.



Using Bookmarks in Java Links

It's normal enough to confuse the Link and Target parameters in Java applets when it comes to bookmarks, so people often tend to try to put the page address in the link parameter of an applet, and the bookmark along that page in the target parameter.  However, the bookmark, as in HTML, is actually part of the URL.  The name of the link parameter may differ depending on the applet, but the value= should look like this:

<PARAM NAME="Link" VALUE="http://www.sitename.com/page.html#BookMark">

Note the use of the # sign to delineate the bookmark, and be sure to use the full, explicit, http:// format for the address in most cases.



Using URL's in JAVA Applets - What Won't Work and What Will

In link parameters, virtually always you *must* use the full, explicit URL path to the page you wish to open.  A 'referential' or 'relative' link just to a page name generally won't work, as typical Java applets don't know where they are to begin with.  By a full, explicit path, we mean this format:


However, this is usually *not* necessary for the resources an applet requires for its own internal use (say, images or sound files).  In those cases, just the relative path is typically used (that is, just the filename; and if any, the directory path).

(If you're wondering why this is, it goes to security considerations built directly into the Java language.)



Links and Targets in Java Applets - Which is Who

This is a subject that perpetually confuses Java applet users.  Simply put, a Java link parameter contains *what* you want to display -- the full URL of the page to which the link goes.

A Java target, on the other hand, is *where* you want to show it.

You have two target choices -- either in the current browser window or a new one; or, if you are using a framed layout, which frame within that framed layout.

For targeting the browser, these are the usual values:

VALUE = "_new" opens a new window
VALUE = "_blank" also a new window
VALUE = "_self" loads in the same frame
VALUE = "_top" opens in the same window

You'll note that these are the same as used in HTML. Be certain to include the underscore!

For targeting an individual frame within a frameset (framed layout), then simply use the NAME of the frame.  If you're unsure of what that NAME is, look in the <frameset> code for your page.  If you're using FrontPage, right-click over the page and look at the frame properties dialogue.



Dealing with CODE= and  CODEBASE=

Both of these will be explained below momentarily; but first, a few comments...

We discourage use of CODEBASE= in most cases, especially for new users, and especially when first setting up an applet.  Put everything in one place until you get an applet rolling, and don't even think about using CODEBASE= until you've ironed out any and all other problems.

Note also that if you use FrontPage, it chronically inserts the CODEBASE= tag automatically when you move resources, and often does so incorrectly!  Obviously, this bears watching whenever you run into difficulty in FrontPage with Java applets.

There are also some cases, depending on the internal coding of certain applets, where these tags may *fail* to function correctly!

Please do *not* confuse CODE= (which only names the .class file of the applet, and must be present in every <applet> tag) with CODEBASE= (which is optional)!

That said, the general ideas involved are simple enough.

CODE= tells the page what applet file to call.  That's it, that's all.  It contains, typically, nothing more than the applet.class filename.

CODEBASE= is likewise simple enough.  For reasons of resource economy and organization, there are sometimes good reasons for you to put the files related to an applet in a directory other than that of the page that calls the applet.

In such cases, CODEBASE= will contain either the full, explicit path to the resources, or a 'referential' or 'relative' path to the resources.  (There are exceptions, of course, but in many cases, CODEBASE= *will* even allow you to call resources on an entirely different server altogether.)

Once again, though:  Caution!  Problems resulting from incorrect use of CODEBASE= are among the most frequently encountered!



Creating Java AU Sound Files

Although newer standards are more flexible, for virtually all currently available Java applets, the long-established Sun standard for sound files is the *only* one that will work.

There isn't anything special about a Java sound file -- except its basic format!  Java sound files *must* be saved in this explicit, specific format:

8-bit u-law mono and 8000 Hz.

Since there are several other possible formats in which .au files can be made, take *caution* that many .au files found out on the Net generally are *not* in the proper format for Java applets... and consequently just will not work with them.

Some free sound editors, perhaps even one that came with your system utilities, do support this standard; but many will not have the option to save a file in this format.  One that we have used for quite some time is Syntrillium.com's CoolEdit.  


- Copyright 1995-2014 by CodeBrain.com
CodeBrainŽ CodeBrain.comŽ
All  Rights Reserved

A wise man eats both with his mouth and with his shoes.
Four candles do not make the camel sing.