com.java4less.rmenu
Class RMenuApplet

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--com.java4less.rmenu.RMenuApplet
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class RMenuApplet
extends java.applet.Applet

The RMenuApplet is a thin layer on the RMenu class that allows you to use the RMenuas an applet in a web page. The parameters for the applet are:

Parameters of the applet 

Allmost all parameters are Strings or Integers, however the are some special cases:

The parameters of the applet are:

The following parameters define default values for the nodes:

The following parameters define the value for a given node. The * must be substituted by the node's name. If the parameters are used in Javascript or in a definition file the *_ should not be included:

 

The following parameters will allow you to execute JavaScript functions when something happens:

See the file Example3.html to see an example of these parameters. 

 

Loading from files

The data for a node or menu can also be loaded from a text file instead of using the parameters of the applet. The advantadge of this approach is:

The structure of the file is very simple; each file contains the definition of the children of one node only. Each line in the file contains one command. The command can be:

For example:

CHILD=Index
ICON=car1.gif
SELECTED_ICON=car2.gif
DATA_FILE=file://www.myserver/IndexNodes.txt
TEXT=Index
CHILD=Features
.
.
.

 This file creates a new node called "Index". The following 4 lines contain some parameters for this node. This parameters have the same name as those used in the applet parameters (without the *_). Note that the children of the node "index" will be defined in the file "IndexNodes.txt".

Javascript

It is also possible to change teh appearance of the menu from Javascript (See the file Example1.html to see an example of this). The following methods can be accessed from javascript :

See Also:
Serialized Form

Field Summary
static int BORDER_DOUBLE
           
static int BORDER_LINE
           
static int BORDER_LINE2
           
static int BORDER_LOWERED
           
static int BORDER_RAISED
           
static int BORDER_SHADOW
           
 java.awt.Color borderColor
           
 int borderType
           
static int NO_BORDER
           
 java.awt.Color pageBackColor
           
 RMenu tree
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
RMenuApplet()
           
 
Method Summary
 void clearTree(java.lang.String nodeName)
          deletes the children of the node.
 void init()
           
 void loadNode(java.lang.String nodeName, java.lang.String sFile)
          loads the children of the node nodename from the file sFile.
 void refreshTree()
          repaints the tree.
 void setBorderBackground()
           
 void setParam(java.lang.String nodeName, java.lang.String Param, java.lang.String Value)
          Sets a parameter for a node.
 void start()
           
 
Methods inherited from class java.applet.Applet
destroy, getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tree

public RMenu tree

NO_BORDER

public static final int NO_BORDER

BORDER_LINE

public static final int BORDER_LINE

BORDER_RAISED

public static final int BORDER_RAISED

BORDER_LOWERED

public static final int BORDER_LOWERED

BORDER_DOUBLE

public static final int BORDER_DOUBLE

BORDER_SHADOW

public static final int BORDER_SHADOW

BORDER_LINE2

public static final int BORDER_LINE2

borderType

public int borderType

pageBackColor

public java.awt.Color pageBackColor

borderColor

public java.awt.Color borderColor
Constructor Detail

RMenuApplet

public RMenuApplet()
Method Detail

setParam

public void setParam(java.lang.String nodeName,
                     java.lang.String Param,
                     java.lang.String Value)

Sets a parameter for a node. This methods allows the configuration of the applet from javascript. For example, in order to change the icon of a node called "node1":

javascript:document.tree.setParam('node1','ICON','newicon.gif');

 In the example "tree" is the name of the applet.


clearTree

public void clearTree(java.lang.String nodeName)
deletes the children of the node.

loadNode

public void loadNode(java.lang.String nodeName,
                     java.lang.String sFile)
loads the children of the node nodename from the file sFile.

refreshTree

public void refreshTree()
repaints the tree. The Javascript should call this after using other functions in other methods.

init

public void init()
Overrides:
init in class java.applet.Applet

start

public void start()
Overrides:
start in class java.applet.Applet

setBorderBackground

public void setBorderBackground()