The Applet

Truely the easiest applet to configure.


The following is how the applet looks within html:


           <applet 
              archive="gmenu.jar"
              code=geracemenu.parseMenuApplet.class width=180 height=210>
              <param name=menu value="menudef1.p">
           </applet>
        

and that's it there's to it!

The script

Scripts are stored in files with .p extension by default, but are not restricted to any particular name (and extension) and can be anything (allowed on the system, that is).

The script source is composed of two parts: the "options" section which allows for global variable definition and the "menudef" section that describes the menu.

While the both parts are optional the order they come with is worthnoting. The "options" section if specified always comes the first.

Options

Rule for the "options" section looks like this:


              options:
                ("options" '{' (var_decl)* '}' )? ;
              var_decl: 
                 var_name '=' STRING_LITERAL ';' |
                 var_name '=' NUMBER ';' |
                 var_name '=' BOOL ';' | 
                 EMPTY ;
           

and in a file "options" structure is as follows:


              options {
                var1 = value1;
                var2 = value2;
                ... // and so on
              }
           

where

  • var_name is one of the variables optionally specified for each menu system unit.

Menudef

Rule for the "menudef" section looks like this:


              menudef:
                ("menudef" '{' itemstmtseq '}' )? ;
              itemstmtseq: 
                itemstmt itemstmtseq ;
              itemstmt:
                ('(' STRING_LITERAL ',' item_id (options)? itemstmtseq ')')* 
                      |
                EMPTY ;
           

and in a file "menudef" structure is as follows:


              menudef {
                ("rich text", MENU_ID
                  options {
                    var1 = value1;
                    ... // and so with values
                  }
                  ("rich text", ITEM_OR_MENU_ID
                    ()
                    ... // and so on recursivly
                  )
                  ... // and so on with subitems
                )
                ()
                ... // and so with toplevel items
              }
           

where

  • item_id is one of ("FLATMENU", "DROPDOWNMENU", "MENU", "ITEM", "SEPARATOR", "LABELLEDITEM" or "LISTITEM")

Gobal options

layout

String

Sets the menu layout mode. "flat" and "dropdown" are the only valid values.
Flat layout is used for menus laid out horizontally, while dropdown menus are the vertically laid out ones.

backgroundColor

String

Defines which color the toplevel menu panel is. Color definition is similar to html, i.e. major symbolic values as well as '#rrggbb' forms are well supported.

backgroundImage

String

Defines an external tile image for the menu panel. Images are to be found in the applet's codebase directory. If you supply both backgroundColor and backgroundImage, the tile image has the higher priority and thus will be used first of all. (not yet implemented)

Item options

selectionColor

String

Sets the selected item's color to this value.

transparency

Integer

Sets the selection transparency level to the specified value (in %), ranges from 1% to 100%, defaults to 100% with no filtering.

selectable

Boolean

Defines if an item be selectable

The following items have been derived from ItemNode and thus bare all of it's options plus the specifically defined ones.

Separator Item options

height

Integer

Defines the bar height of a Separator item.

List Item options

listType

String

Sets list type to one of the predefined types (square (default), circle, disc, 3drect_sunk, 3drect_raised)

listSize

Integer

Sets the listitem size in pixels

listColor

String

Defines the color to use for the label

listImage

String

Defines that an external image be used (highest priority if specified)

Embossed Item options

carvingType

String

Sets the carving type to the specified value. There're two carving types: "sunk" (default, carve inwards), and "raised" (mould in relief).

Menu options

backgroundColor

String

is inherited from Item

backgroundImage

String

Sets the background tile image to use in a popup, that shows the items of the very submenu (not yet implemented).

pointerActiveColor

String

Defines the color of the tiny triangle a menu item has to its right (to indicate there's more items) when it's selected.

pointerInactiveColor

String

Defines the color of the tiny triangle when it's inactive.

pointerImage

String

Sets the submenu pointer to the specified image.

backgroundEnable3d

Boolean

Specifies whether to use a 3d background for the popup.

Item identifiers

ITEM

Most essential menu system unit: constructs an ordinary (non-menu) item

LABELLEDITEM

Inselectable item, basically used for menu headings

LISTITEM

A list item. Submenus can't be list items yet.

EMBOSSITEM

A carved-style item.

SEPARATOR

A menu item separator item

MENU

Most essential submenu item, not clickable

FLATMENU

Submenu item used with 'flat' menu layouts, is clickable and a url can be assign (via the "href" tag)

DROPDOWNMENU

Submenu item used with 'dropdown' menu layouts, is clickable and a url can be assign (via the "href" tag)

Script example
(the one to your left)


           options {
             //backgroundColor = 'gray';
             backgroundColor = '#336688';
             layout = 'dropdown';
           }
           
           menudef {
             ("<img src='images/LightBulb.gif'> <s=18><c='#a0a050'><b>A</b>bout", DROPDOWNMENU
               options {
                 //selectionColor = "#00cccc";
                 transparency = 65;
                 pointerImage = 'images/FingerRight.gif';
               }
               ("<a=center><img src='images/aniflower.gif' animated> <b><s=18><c=green>Gerace<c=darkgray> Menu System \n \n<s=-6><i><c=#505050></b>written by dosler\n(c) 1999.", EMBOSSITEM
                 options {
                   carvingType = 'sunk';
                   selectable = false;
                 }
               )
           
               ("<b>Features include:", LABELLEDITEM)
               ("<b><c=blue>Genuinely</b> richtext items driven by a \nmarkup language with support for \ndifferent text styles and (<b>animated</b>) \nimages", LISTITEM
                 options {
                   listType = "3drect_sunk";
                   listSize = 6;
                   listColor = '#00ccff';
                   selectionColor = '#99cccc';
                   listImage = 'images/punkt.gif';
                   transparency = 50;
                 }
               )
               ("<b><c=blue>Two</b> supported layout types:\n<a=center><c=cyan><s=15><i><b>flat</b></i>\n<c=blue><s=-1>and\n<c=cyan><i><b><s=+1>dropdown", LISTITEM
                 options {
                   listType = "3drect_sunk";
                   listSize = 6;
                   listColor = '#00ccff';
                   selectionColor = '#99cccc';
                 }
               )
               ("<b><c=blue>Complete</b> script-aided customization", LISTITEM
                 options {
                   listType = "3drect_sunk";
                   listSize = 6;
                   listColor = '#00ccff';
                   selectionColor = '#99cccc';
                 }
               )
               ("<b><c=blue>Unlimited</b> levels of submenu recursion", LISTITEM
                 options {
                   listType = "3drect_sunk";
                   listSize = 6;
                   listColor = '#00ccff';
                   selectionColor = '#99cccc';
                 }
               )
               ("<b><c=blue>Diversity</b> of representation", LISTITEM
                 options {
                   listType = "3drect_sunk";
                   listSize = 6;
                   listColor = '#00ccff';
                   selectionColor = '#99cccc';
                 }
               )
             )
           
             ("", SEPARATOR)

             ("<img src='images/punkt.gif'> <href='http://www.javacats.com/us' title='Java Cats directory' target='_top'><c=white><b>Welcome to <c=green>JavaCats<c=white>\nThe ultimate java directory", DROPDOWNMENU
               options {
                 selectionColor = '#bbbbff';
                 pointerActiveColor = 'green';
               }
               ("<img src='images/item_1.jpg'>", ITEM
                 options {
                   selectionColor = 'blue';
                   transparency = 75;
                 }
               )
               ("<img src='images/item_2.jpg'>", ITEM
                 options {
                   selectionColor = '#305090';
                   transparency = 75;
                 }
               )
               ("<img src='images/item_3.gif'>", ITEM
                 options {
                   selectionColor = 'cyan';
                   transparency = 75;
                 }
               )
             )
           
             ("<img src='images/punkt.gif'> <href='http://java.wiwi.uni-frankfurt.de' title='Java Repository directory' target='_top'><c=white><b>Java <c=#20205f>Repository", DROPDOWNMENU
               options {
                 selectionColor = '#bbbbff';
                 transparency = 65;
               }
               ("<b>Alignment:</b> centered", LABELLEDITEM)
               ("", SEPARATOR)
               ("<a=center><s=15>Top <s=+2>Selection", ITEM)
               ("<align=center><b>Choose your <s=17><c=orange>destiny", MENU
                 options {
                   backgroundColor = "#00ccff";
                 }
                 ("<b>Easy and quick recess", LISTITEM
                   options {
                     listColor = 'red';
                     listType = '3drect_raised';
                     transparency = 15;
                   }
                 )
                 ("<b>Tough balls", LISTITEM
                   options {
                    listColor = 'green';
                    listType = '3drect_raised';
                    transparency = 50;
                  }
                )
                ("<b>Die hard", LISTITEM
                  options {
                    listColor = '#6699ff';
                    listType = '3drect_raised';
                    transparency = 80;
                  }
                )
              )
              ("<a=center><b><c=cyan><s=15>Last but not least", ITEM
                options {
                  selectionColor = 'blue';
                  backgroundColor = "#5090ff";
                }
                ("<b><s=+2><a=center>James Arthur Gosling", EMBOSSITEM
                  options {
                    carvingType = "sunk";
                    transparency = 60;
                  }
                )
                ("<b><s=+1><a=center>Terence Parr", EMBOSSITEM
                  options {
                    carvingType = "raised";
                    transparency = 60;
                  }
                )
                ("<a=center><img src='images/firelink.gif' animated>", ITEM)
              )
            )
          
            ("<img src='images/punkt.gif'> <href='http://www.javaboutique.com' title=\"Java Boutique - developer's prosperity\" target='_top'><c=white><b>Java <c=blue>Boutique", DROPDOWNMENU
              options {
                selectionColor = '#bbbbff';
              }
              ("<b>Alignment:</b> right", LABELLEDITEM)
              ("", SEPARATOR)
              ("<a=right><b><s=16>Stars never die", EMBOSSITEM
                options {
                  transparency = 50;
                }
              )
              ("<a=right><b><s=16>They just go home ... <img src='images/LightBulb.gif'>", EMBOSSITEM
                options {
                  carvingType = 'raised';
                  transparency = 50;
                }
              )
            )
          
            ("<img src='images/punkt.gif'> <href='http://www.javashareware.com' title='Shareware java development' target='_top'><c=white><b>Java <c=#141520>Shareware", DROPDOWNMENU
              options {
                selectionColor = '#bbbbff';
                backgroundColor  ='#99cccc';
              }
              ("List item #1\ncontinues...", LISTITEM
                options {
                  listSize = 6;
                  listType = '3drect_sunk';
                  listColor = '#00ccff';
                  transparency = 25;
                }
              )
              ("List item #2", LISTITEM)
              ("List item #3", LISTITEM
                options {
                  listSize = 6;
                  listType = '3drect_raised';
                  listColor = '#00ccff';
                  transparency = 50;
                }
              )
              ("<a=right>List item #4\n<s=17>continues...\n<s=+3>and continues...", LISTITEM
                options {
                  listSize = 8;
                  listType = 'disc';
                  listColor = '#006699';
                  transparency = 75;
                }
              )
            )
          
            ("", SEPARATOR)
          
            ("<b><s=17><c=#33ff66><i>Download", DROPDOWNMENU
              options {
                pointerImage = 'images/FingerRight.gif';
                transparency = 50;
              }
              ("<href='http://www.krasu.ru/mc/downloads/java/gmenu_set.zip'><b><c=#3366ff>Download the <u>Gerace Menu System</u> package", ITEM
                options {
                  selectionColor = "#00ccff";
                }
              )
            )
          }        
       

Appendix