DJPopMenu Applet

Typical Applet Configuration

Note that two files are required to run this applet. The  djpopmenu.class and the archive ZIP file called dpopmenu.zip
The zip file contains some support classes and must be included in the applet definition.

This applet will display three text entries called "Java Sources" "Java Applets" and Home Pages"
The entry "Java Sources" will contain a child menu called Decafs Free Applets"

Note: this applet may not run locally with Netscape Navigator due to security restrictions . If you have troubles viewing the applet example, view it in Explorer when looking at it locally on your machine. 

Please read this !!!!!
Most of the Email questions concerning this applet has to do with making this applet appear and disappear with a MouseOver and MouseOut effect. Due the nature of the way the popup menu class in java works I CAN NOT OFFER THIS FEATURE !!.  Please do not ask me for it.  You will save me hours of email responses a week. 
 

Required files and images :

  • dpopmenu.class
  • djpopmenu.zip
  • frog.gif
  • baloon.gif
  • usa.gif


<applet code = djpopmenu archive = djpopmenu.zip height = 200 width = 160 >

  <param NAME = backgroundColor VALUE = 0x99CC99>
 <param NAME = foregroundColor VALUE = 0x000000>
   <param NAME = panelbackgroundColor VALUE = 0x99CC99>
  <param NAME = canvasbackgroundColor VALUE = 0x99CC99>
  <param NAME = textColor VALUE = 0x000000>
  <param NAME = altTextColor VALUE = 0xFF00FF>
  <param NAME = appletFontSize VALUE = 14>
  <param NAME = bordersize value = 2>
  <param NAME = menuFontSize value = 12>
  <param NAME = frame value = _top>
  <param NAME = imageOffset VALUE = 50>
  <param NAME = alignment VALUE = vertical>
  <param NAME = 3DBorder value = true>
  <param NAME = splash  value = "loading images">
  <param NAME = logo  value = "mylogo.gif">

  <!-- this code defines the images and any text to display . It also defines the X-Y position for each menu-->

  <param name = menuimg0 value = "frog.gif|Java Sources">
  <param name = menuimg0Xoffset value = 100>
  <param name = menuimg0Yoffset value =  100>
  <param name = menuimg0TextOffset  value =  0>
  <param name = menuimg0ImageOffset  value =  0>

  <param name = menuimg1 value = "baloon.gif|Java Applets"  >
  <param name = menuimg1Xoffset value = 100>
  <param name = menuimg1Yoffset value =  100>
  <param name = menuimg1TextOffset  value =  0>
  <param name = menuimg1ImageOffset  value =  0>

  <param name = menuimg2 value = "usa.gif|Home Pages">
  <param name = menuimg2Xoffset value = 100>
  <param name = menuimg2Yoffset value =  100>
  <param name = menuimg2TextOffset  value =  0>
  <param name = menuimg1ImageOffset  value =  0>
 

  <!-- this code define the main menu for the first image -->

  <param name = img0menu0  value = " " >
  <param name = img0menu0item0  value = "JavaSoft API spec|http://www.javasoft.com>optional_frame" >
  <param name = img0menu0item1  value = "-" >
  <param name = img0menu0item2  value = "img0menu1" >
  <param name = img0menu0item3  value = "Java Boutique Top 100 |http://javaboutique.internet.com/stats/top_100.html" >
  <param name = img0menu0item4  value = "JAR's Top 25%|http://www.jars.com" >
  <param name = img0menu0item5  value = "TUCOW's - Good site for Web Utilities|http://www.tucows.com" >

  <!-- this code defines the submenu referenced above in image0menu0item2 -->

  <param name = img0menu1  value = " Some of DecafJava's Free Applets" >
  <param name = img0menu1item0  value = "DJSearch|applets.html" >
  <param name = img0menu1item1  value = "DJGoURL|applets.html" >
  <param name = img0menu1item2  value = "DJImageTrack|applets.html" >
  <param name = img0menu1item3  value = "DJTypeW|applets.html" >
  <param name = img0menu1item4  value = "DJScroll|applets.html" >
  <param name = img0menu1item5  value = "DJClock|applets.html" >
 

  <!-- this code define the main menu for the second image -->

  <param name = img1menu0  value = " " >
  <param name = img1menu0item0  value = "DJSearch|applets.html" >
  <param name = img1menu0item1  value = "DJGoURL|applets.html" >
  <param name = img1menu0item2  value = "DJImageTrack|applets.html" >
  <param name = img1menu0item3  value = "DJTypeW|applets.html" >
  <param name = img1menu0item4  value = "DJScroll|applets.html" >
  <param name = img1menu0item5  value = "DJClock|applets.html" >
 

  <!-- this code define the main menu for the third  image -->

  <param name = img2menu0  value = " " >
  <param name = img2menu0item0  value = "Back to my Home Page|index.html" >
  <param name = img2menu0item1  value = "-" >
  <param name = img2menu0item2  value = "Java Boutique Home Page |http://javaboutique.internet.com" >
  <param name = img2menu0item3  value = "-" >
  <param name = img2menu0item4  value = "JAR's Home Page|http://www.jars.com" >
  </applet>
 
 
 
 

Parameter Definition
 
 
backgroundColor The background color of the applet 
canvasbackgroundColor The background color of the canvas area
foregroundColor The color of text displayed in the splash screen if used. 
panelbackgroundColor the background color of the panel. This is the border color if selected with borderSize > 0
textColor The text color of the Text Description of Images
alttextColor The alternate color of the text description when the mouse is over the Image.
appletFontSize The font size of the text description. Default is 12 if not defined
splash The variable allows the user to place a message in the applet area while waiting for the image to load. The text is centered in the applet , displayed in the fonsize "appletFontSize" and is drawn in the Color " forgroundColor". Default is no message .
menuFontSize The variable allows you to change the font size of the popupmenu selections. Default is 12 if not supplied
borderSize The size of the border in pixels. 0 = no border. The color defined in panelbackgroundColor will be the border color.  Default is 5 if not defined.
imageOffset A "fudge factor " for Image layouts. Make this value is equal to or greater than your largest image
alignment Defines whether the applet displays images in a Vertical or Horizontal alignment.
Default is "vertical" if the parameter is not defined. 
Frame Optional parameter that tells the applet where to launch the URL's. See note below for sending URL's to different frames.
3DBorder If "true" then images will have a "3D" button around them when the mouse is over the image
Default is "true" if the parameter is not defined
Logo Allows the user to place a graphic image at the top of the applet that is not related to the pulldown images. This can be used as a Logo or other graphically instruction. If used the Applet will adjust the position of the pulldown images automatically. "value" can be be any valid graphic format. 
menuimg(n)TextOffset This is an integer value .This parameter allows you to adjust the position of the Text associated with the menu so that the text can be lined up correctly in either the vertical or horizontal orientation. This parameter should be used if your images are not all the same size.  If all your images are the same size, you probably do not need this parameter. Value can be positive or negitive.
menuimg(n)ImageOffset This is an imteger value. This parameter allows you to adjust the position of the Image associated with the menu so that the Images can be lined up correctly in either the vertical or horizontal orientation. This parameter should be used if your images are not all the same size.  If all your images are the same size, you probably do not need this parameter. Value can be positive or negitive.
menuimg(n)Xoffset This is the X position from the center of the image to place the popup menu for each selection 
menuimg(n)Yoffset This is the Y position from the center of the image to place the popup menu for each selection. 
menuimg0 - menuimg (n)   these are the images to place in the applet. See notes below for format.
image(n)menu(n) Pulldown menu definitions for the associated Image. See notes below for examples. 

Note: All colors are entered in either hexidecimal or decimal RGB format . As an example , the color white = 0xFFFFFF in hex and white = "255,255,255" in RGB format.

Image Definitions

This applet supports up to twenty(20) images and each image is defined with 2 parameters : the image itself , and the optional descriptive text associated with it. The two parameters are separated with the "|" character as shown in the typical applet definition above.

an example is  :

< PARAM name = "menuimage0" value = "image_1.gif | image description for image 1>
< PARAM name = "menuimage1" value = "image_2.gif | image description for image 2>
etc
etc.
< PARAM name = "menuimage20" value = "image_20.gif | image description for image 20>

The Parameter imageOffset should be used to position the images where you want them to be.
 

Menu definitions

Menus are attached to Images as follows :

the first image is attached to the menu called image0menu0.
the second image is attached to the menu called image1menu0.
the third image is attached to the menu called image2menu0.
etc.
 .
 .
etc.

Each menu has up to fifty(50) items associated with it. Each item is defined in the format

image0menu0item0        the first item in the list
image0menu0item1        the second item in the list
etc.

Each item has two (2) parameters associated with it. The item name that will be displayed in the pulldown list, and the URL that the user will be sent to when the item is selected with a mouse click. As with the image definitions, the two parameters are seperated with the "|" character.

referencing sub menus

A menu item can reference another menu. To do this, put the new menu reference in the value field of the parameter instead of a document page.
As with the other examples we will assume that we are referencing the first image. Since the first image's menu is called "image0menu0" we reference the sub menu as "image0menu1".   The main menu could also reference another menu called "image0menu2".  To further go down the menu tree, the sub menu "image0menu1" could have a reference to a third menu called "image0menu3".
The number of the menus is not important. The only restriction is that all menus associated with the first image start with the description "image0"
Note: Unlike the main menu for the image, sub menus need a value parameter. This is the name that appears in the main menu that references the sub menu.
 

Launching URL's to different frame locations

The "frame" parameter is a global parameter. All URL's are typically launched to the frame specified here. If you wish to launch URL's toa different frame then the default use the following format in the image(x)menu(x)item(x) definition :

Example:

 <param name = img0menu0item0  value = "JavaSoft API spec|http://www.javasoft.com > optional_frame" >

If the ">" symbol is detected after the URL then a frame definition is expected. Just enter the frame you what this particular URL to be launched to. If the additional parameter does not exist, then the global "Frame" parameter will be used.

In the example about , the URL will be launched to a frame called  " optional_frame "
 

Single Selection menu entries ( Special case) 

If a pulldown selection contains only one entry, the popup menu will not be displayed. Instead, the URL associated with the entry will be launched when the user clicks the mouse button. This allows you to have an image that does not use a pulldown menu.
 
 

Confusing !! Not really ...
Examine the sample code listed above in the typical applet definitions above and follow the path of the menus. I think you'll find it quit logical when you see the flow of the layout.
 
 



© 2000, DecafJava. All rights reserved.
All evaluation applets are fully functional copies of our commercial versions. A reference to our Web Site appears on the status bar.
DECAF JAVA