A small Java applet to show
two-levels menus in web pages
(New version: 1.32, updated Jan 26 2003)
This page hosts a Java applet that allows the creation and utilization
of a two-levels menu applet (what? another one?) to be used in web
pages.
A number of more or less similar applets already exist over the
Internet, so the obvious question is:
Why another menu applet?
The answer is:
Because existing menu applets don't satisfy my needs, they
don't perform so well, or they have design limitations; moreover,
writing a new applet is always enjoying, provided that I have
enough spare time.
Anyway, let's go ahead.
Applet description
This applet allows to show a menu of choices in a web page by a
Java1.1-compliant browser (so old browsers such as Netscape Navigator
or Internet Explorer earlier than 4.x, are *not* able to run this
applet): every choice may have a small image (i. e. a GIF or
a JPEG file) and/or some text. When the user clicks on a menu choice,
the browser will open the page with the corresponding URL. If the
number of choices is high, it's possible to organize them in two
levels: clicking on a top-level choice, corresponding sub-level
choices will be shown.
The appearance of this applet is widely configurable by means of
PARAM tags:
- General parameters
- ScrollingAllowed: boolean value (TRUE or FALSE)
that makes the menu scrolling possible if the applet area
is too small for the menu being completely displayed (default
FALSE). (note: feature added in v. 1.3)
- Background: colour of applet background, in RRGGBB
hexadecimal format (i.e. 000000=black, FFFFFF=white, FF0000=red,
etc.). Default: FFFFFF (white).
- BackgroundSubMenu: colour of sub-menu background
(when visible), in RRGGBB hexadecimal format. Default: FFFFFF
(white).
- DefaultFont: default font (format: "Name,attributes,pointSize",
i.e. "SansSerif,BOLD+ITALIC,14"); this may be overridden
for single menu choices by using ChoiceN-FONT parameter.
Default: "SansSerif,BOLD,12". (note: because
of a bug introduced in previous versions, this parameter did
not work; starting from v. 1.31 it works regularly)
- TextColor: menu choices text color. Default: 000000
(black).
- TextColorSubMenu: sub-menu choices text color (when
visible). Default: 000000 (black).
- TextColorHighlight: menu choices text color while
they under the mouse pointer. Default: 0000FF (blue).
- TextColorPressed: menu choices text color while
they are "pushed" by the mouse. Default: FF0000
(red).
- DefaultFrame: name of destination frame to open
URLs. This option may be overridden for single menu choices
by using ChoiceN-FRAME (see below). Default: _self
(the same frame of the applet).
- DefaultChoiceHeight: height of each menu choice.
Default: 25.
- Specification of menu choices
- ChoiceN (N ranging from 0 up): text of choice no.
N (i.e., first choice must be named Choice0, second
choice must be named Choice1, etc.). If the text
is "-" (a single dash), *no* text will be shown
for this choice (tipically for graphics-only choices).
- ChoiceN-URL (N ranging from 0 up): URL to open
whe user clicks choice no. N (optional).
- ChoiceN-IMG (N ranging from 0 up): URL of image
to be shown on the left of menu choice text no. N (optional).
- ChoiceN-IMG2 (N ranging from 0 up): URL of image
to be shown on the left of menu choice text no. N while it
is under the mouse pointer (optional).
- ChoiceN-IMG3 (N ranging from 0 up): URL of image
to be shown on the left of menu choice text no. N while it
is "pushed" by the mouse (optional).
- ChoiceN-FRAME (N ranging from 0 up): name of destination
frame of the URL of choice no. N (optional).
- ChoiceN-FONT (N ranging from 0 up): font to be
used for menu choice no. N (format: "Name,attributes,pointSize",
i.e. "SansSerif,BOLD+ITALIC,14") (optional). (note:
because of a bug introduced in previous versions, this parameter
did not work; starting from v. 1.31 it works regularly)
- ChoiceN-HEIGHT (N ranging from 0 up): height of
choice no. N (optional). (note: feature added in v. 1.2)
- Specification of sub-menu choices
- ChoiceN-M (N and M ranging from 0 up): text of
choice no. M of sub-menu no. N (i.e., first choice of first
sub-menu must be named Choice0-1, second choice of
first sub-menu must be named Choice0-1, first choice
of second sub-menu must be named Choice1-0, second
choice of second sub-menu must be named Choice1-1
etc.). If the text is "-" (a single dash), *no*
text will be shown for this choice (tipically for graphics-only
choices).
- ChoiceN-M-URL (N and M ranging from 0 up): URL
to open whe user clicks choice no. M of sub-menu no. N (optional).
- ChoiceN-M-IMG (N and M ranging from 0 up): URL
of image to be shown on the left of menu choice text no. M
of sub-menu no. N (optional).
- ChoiceN-M-IMG2 (N and M ranging from 0 up): URL
of image to be shown on the left of menu choice text no. M
of sub-menu no. N while it is under the mouse pointer (optional).
- ChoiceN-M-IMG3 (N and M ranging from 0 up): URL
of image to be shown on the left of menu choice text no. M
of sub-menu no. N while it is "pushed" by the mouse
(optional).
- ChoiceN-M-FRAME (N and M ranging from 0 up): name
of destination frame of the URL of choice no. M of sub-menu
no. N (optional).
- ChoiceN-M-FONT (N and M ranging from 0 up): font
to be used for menu choice no. M of sub-menu no. N (format:
"Name,attributes,pointSize", i.e. "SansSerif,BOLD+ITALIC,14")
(optional). (note: because of a bug introduced in previous
versions, this parameter did not work; starting from v. 1.31
it works regularly)
- ChoiceN-M-HEIGHT (N and M ranging from 0 up): height
of choice no. M of sub-menu no. N (optional). (note: feature
added in v. 1.2)
Conditions
Use of this applet is free, and there are no limitations. The source
can be freely downloaded and modified, too. Obviously, I'll be glad
if someone sends me improved versions of this applet, so I can make
them available on this page.
Examples and download
|