ButtonBar
The applet gets almost all
of the information via parameters. The parameters have to be set in the
HTML Code, as part of the <applet> tag (To see how to create the HTML
code read the HTML code page).
The parameters and their function:
(Parameters marked with
a * are required)
| * |
NORMBUTTON |
This parameter specifies
the image file which shall be displayed for buttons in normal condition
(not pressed, not highlighted). It has to be a .GIF or a .JPG (.JPEG
respectively) file. Remember that filenames on the Internet are case sensitive!
The file name has to be written correct, if you mix up lower and upper
case it'll cause errors. |
| * |
HIGHLBUTTON |
Not all too difficult to
guess, is it? The same rules as above apply, only that this parameter specifies
the file to be displayed when a button is highlighted (when the mouse is
over a button, but the button is not pressed). |
| * |
PRESSEDBUTTON |
It should be obvious... |
| |
SPECNORMBUTTON# |
You can give a button a
different image than the default one with this parameter. It has to have
the same size as the default buttons. |
| |
SPECHIGHLBUTTON# |
Same as SPECNORMBUTTON#,
only for highlighted status. |
| |
SPECPRESSEDBUTTON# |
Same as SPECNORMBUTTON#,
only for highlighted status. |
| |
BACKGROUNDIMAGE |
A .GIF or .JPG image which
will be displayed underneath the button images. It does not necessarily
have to be of the same size as the applet. If it is smaller it will be
tiled to fill the entire applet area. |
| |
MOUSEOVERSOUND |
The sound which is played
when the mouse moves from one button to another. The sounds have to be
8 bit, µlaw, 8000 Hz, one-channel Sun ".au" files. |
| |
PRESSEDSOUND |
The sound which is played
when a button is pressed. The same rules as with "MOUSEOVERSOUND" apply. |
| |
ORIENTATION |
Default value is vertical.
You can make a horizontal buttonbar by setting this parameter to "horizontal". |
| |
DEFAULTALIGNMENT |
Defines the text alignments
on the buttons. Legal values are: "left" and "right". Not defining this
parameter will center the text on the buttons. |
| |
DEFAULTFONTNAME |
Usually the default font
name is "Helvetica" (on PCs running MS Windows this font is called "Arial").
You can change the default name with this parameter, which is more easy
than changing the font name for every button manually. For more info on
font names see "FONTNAME#". |
| |
DEFAULTFONTSTYLE |
Usually the default is "PLAIN".
Change the default with this parameter. See "FONTSTYLE#". |
| |
DEFAULTFONTSIZE |
"Standard default" is 12.
See "FONTSIZE#". |
| |
DEFAULTFONTCOLOR |
Default is usually black.
See also:
|
| |
DEFAULTHIGHLFONTCOLOR |
Usually the buttons don't
change their font colors when highlighted. If you want them to do so use
this parameter.
See also:
|
| |
DEFAULTPRESSEDFONTCOLOR |
Same as "DEFAULTHIGHLFONTCOLOR",
only for pressed state.
See also:
|
| |
DEFAULTDESTFRAME |
If most of the pages have
to be displayed in a different frame than the one in which the applet itself
is displayed you can specify a default destination frame where all pages
will be displayed in. If a single page has to be displayed in a different
frame than the default destination frame you have to use the DESTFRAME#
parameter. |
| |
BUTTONSSTAYPRESSED |
If this parameter is specified
the button which was pressed will remain so until another button is pressed.
The purpose is to indicate where on a site the viewer is. It doesn't matter
which value this parameter has, its pure existence suffices to activate
this option. |
| |
STARTBUTTON |
If the option "BUTTONSTAYPRESSED"
is activated button #1 will be in pressed condition after loading. If you
want a different button to be pressed after the applet is loaded you can
specify its number with this parameter. |
| |
BUTTONALIGNMENT# |
You can set a different
text alignment for each button with this parameter. Legal values are "left"
and "right". |
| * |
BUTTONTEXT# |
The text to be displayed
on the button. Make sure it's not too long, the applet won't check the
length. |
| * |
DESTURL# |
Same as with the TEXT# parameter,
but this time you specify the URL to which you want to link this button.
URLs can be relative or absolute, even targets should work fine.
See also:
|
| |
DESTFRAME# |
You can define a frame in
which you want to appear a page a button is linked to. But you don't have
to, if you don't specify a destination frame, the page will be loaded in
the current frame. |
| |
STATUSMESSAGE# |
You can define a short statement
which will appear in the status bar of your browser when the mouse arrow
is over a button. This statement might be a short description of what the
page that's going to appear contains. |
| |
FONTNAME# |
Every button can have a
different font, the name of which you define with this parameter. Valid
values are:
-
Dialog
-
Helvetica (On machines running
MS Windows this is "Arial")
-
TimesRoman (On machines running
MS Windows this is "Times New Roman")
-
Courier
-
DialogInput
-
ZapfDingbats
Default is Helvetica. |
| |
FONTSTYLE# |
The three valid options
are: PLAIN, ITALIC and BOLD. If you skip this parameter
the font will be displayed PLAIN. |
| |
FONTSIZE# |
Pretty obvious... Of course
you can't use all numbers, i.e. a font of the size 100 won't work.
Use the font sizes which work also in your word processing tool. Default
is 12. |
| |
FONTCOLOR# |
If you want a button to
have a different font color than the default color for normal status use
this parameter.
See also:
|
| |
HIGHLFONTCOLOR# |
If you want a button to
change its font color when being highlighted use this parameter.
See also:
|
| |
PRESSEDFONTCOLOR# |
Same as "HIGHLFONTCOLOR#",
only for pressed state.
See also:
|
How
to define colors:
Generally, there are two
ways to define a color:
-
HTML-like: In HTML a
color is defined by three hexadecimal numbers between 0 and 255. These
numbers represent the RGB values, that is the red,
green
and blue shares of the color. By defining
the RGB values you can mix any color you like. For example, to get a red
color like this one
you had to define the shares like this: Red = 255, Green = 0, Blue = 0.
In hexadecimal numbers this would be: Red = FF, Green = 0, Blue = 0. Thus,
to define the color red in HTML you would write "ff0000" (it doesn't matter
whether you write the letters upper- or lowercase). Many image processing
applications have a feature to convert colors to hexadecimal RGB values.
If you do not have such an application yet you might wish to visit www.jasc.com
and download the shareware version of "Paint Shop Pro".
-
Shortcuts:
I
built in shortcuts for some of the most common colors. The shortcuts are:
-
black (is also default)
-
blue
-
cyan
-
darkgray
-
gray
-
green
-
lightgray
-
magenta
-
orange
-
pink
-
red
-
white
-
yellow
Defining
image/audio clip locations and URLs
You can specify URLs in two
ways: either you give the applet just a filename or you specify an entire
URL. If you use just a filename with no path information, the applet will
automatically add the path of the HTML document to create a complete URL.
Example:
If one of your "DestURL#"
parameters links to: "buttonbar_mainframe.html", the applet will
automatically add the document's path to this. The complete URL (which
the applet will use to call the document) will be:
http://welcome.to/javaforall/buttonbar_mainframe.html
(assuming that "http://welcome.to/javaforall"
is the URL where the HTML document is residing).
You can also link to pages
which are stored in subdirectories. A link to a page which is in a subdirectory
called "html_documents" would look like this:
html_documents/buttonbar_mainframe.html
(of course the applet will
add the path of the HTML document to this, as it is not a complete URL).
Image locations are different.
You cannot use a complete URL to define an image location. The applet will
always add the URL of the HTML document into which the applet is embedded
to the location. But of course you can also use subdirectories.
Back to ButtonBar
New on the Java Boutique:
New Review:
Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling
API boasts simplicity, ease-of-integration, a well-rounded feature
set, and it's free!
New Applet:
Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA
sequences into three useful formats.
Elsewhere on internet.com:
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.
|