adm
Class CJavaMenuItem

java.lang.Object
  |
  +--java.awt.MenuComponent
        |
        +--java.awt.MenuItem
              |
              +--adm.CJavaMenuItem

public class CJavaMenuItem
extends java.awt.MenuItem
implements java.awt.event.ActionListener

CJavaMenuItem is a subclasses of awt.MenuItem. It is a invisible beans and must be added to a CMenuButton widget. Unlike awt.MenuItem, the action event is already built into this widget. The user does not need to implement the ActionListener.

CJavaMenuItem is used to launch a java application within the same virtual machine. The application is required to provide a static method named execute (String params[]). The name of this application must be set through the setClassName (String javaName) method. If the params[] is used in the execute method, it must be set using setParams (String[] params) method.

The default label for CJavaMenuItem is String "[J]". If user set the label, the "[J] "+label will be the real label to distinguish them from awt.MenuItem.

Since:
adm0.3
See Also:
Serialized Form

Constructor Summary
CJavaMenuItem()
          Null constructor.
CJavaMenuItem(java.lang.String label)
          Constructor with label parameter
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
          Launch the class by invoke the execute method in the user's application.
 java.lang.String getClassName()
          Return the java class name.
 java.lang.String getLabel()
          Return the label string (not include "[J] ").
 java.lang.String[] getParams()
          Return parameters String array.
 void setClassName(java.lang.String cName)
          Set up the java class name launched by this CJavaMenuItem.
 void setLabel(java.lang.String label)
          Set the label string.
 void setParams(java.lang.String[] params)
          Set up the parameters exexute method needed.
 
Methods inherited from class java.awt.MenuItem
addActionListener, addNotify, deleteShortcut, disable, enable, enable, getActionCommand, getShortcut, isEnabled, paramString, removeActionListener, setActionCommand, setEnabled, setShortcut
 
Methods inherited from class java.awt.MenuComponent
dispatchEvent, getFont, getName, getParent, getPeer, postEvent, removeNotify, setFont, setName, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CJavaMenuItem

public CJavaMenuItem()
Null constructor.

CJavaMenuItem

public CJavaMenuItem(java.lang.String label)
Constructor with label parameter
Parameters:
label - label string
Method Detail

setLabel

public void setLabel(java.lang.String label)
Set the label string. The real label will be "[J] "+label.
Overrides:
setLabel in class java.awt.MenuItem
Parameters:
label - the label String

getLabel

public java.lang.String getLabel()
Return the label string (not include "[J] ").
Overrides:
getLabel in class java.awt.MenuItem

setClassName

public void setClassName(java.lang.String cName)
Set up the java class name launched by this CJavaMenuItem. The user must call this method.
Parameters:
cName - the java class name need launched

getClassName

public java.lang.String getClassName()
Return the java class name.

setParams

public void setParams(java.lang.String[] params)
Set up the parameters exexute method needed. It must called if java class provide with parameters execute method.
Parameters:
params[] - parameters of execute method (array of String)

getParams

public java.lang.String[] getParams()
Return parameters String array.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)
Launch the class by invoke the execute method in the user's application.
Specified by:
actionPerformed in interface java.awt.event.ActionListener