public abstract class EMenuItem
extends java.lang.Object
implements java.awt.event.ActionListener
Modifier and Type | Class and Description |
---|---|
static class |
EMenuItem.CheckBox
A subclass of EMenuItem to represent toggle button.
|
Modifier and Type | Field and Description |
---|---|
static EMenuItem[] |
NULL_ARRAY |
static EMenuItem |
SEPARATOR
A constant to represent separator in menus.
|
Constructor and Description |
---|
EMenuItem(java.lang.String text) |
EMenuItem(java.lang.String text,
char acceleratorChar) |
EMenuItem(java.lang.String text,
javax.swing.KeyStroke accelerator) |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Invoked when an action occurs.
|
protected javax.swing.JMenuItem |
createMenuItem()
Creates fresh GUI instance of this generic EMenuItem.
|
java.lang.String |
getDescription()
Get a string description of the menu item.
|
char |
getMnemonicChar()
Method to return the ALT character that will invoke this menu item.
|
int[] |
getPath()
Get the path of the menu item.
|
java.lang.String |
getText()
Returns hort text description of this EMenuElement.
|
java.lang.String |
getToolTipText() |
boolean |
isEnabled()
Returns enable state of this generic EMenuItem.
|
boolean |
isSelected()
Returns selection state of this generic EMenuItem.
|
protected void |
registerItem()
Register this menu item in EMenuBar.
|
protected void |
registerUpdatable()
Register this item as updatable ( dimmed items or chec box/radio buttons
|
static void |
repeatLastCommand()
Repeat the last Command
|
abstract void |
run()
Abstract method which executes command.
|
static javax.swing.KeyStroke |
shortcut(int keyCode)
Determines which modifier key is the appropriate accelerator
key for menu shortcuts.
|
static javax.swing.KeyStroke[] |
shortcut(int[] keyCode)
Determines which modifier key is the appropriate accelerator
key for menu shortcuts.
|
java.lang.String |
toString() |
protected void |
updateButtons()
Updates GUI buttons after change of state of generic button.
|
protected void |
updateMenuItem(javax.swing.JMenuItem item)
Updates appearance of menu item instance before popping up.
|
public static final EMenuItem[] NULL_ARRAY
public static final EMenuItem SEPARATOR
public EMenuItem(java.lang.String text, javax.swing.KeyStroke accelerator)
text
- the menu item's displayed text. An "_" in the string
indicates the location of the "mnemonic" key for that entry.accelerator
- the shortcut key, or null if none specified.public EMenuItem(java.lang.String text)
text
- the menu item's displayed text. An "_" in the string
indicates the location of the "mnemonic" key for that entry.public EMenuItem(java.lang.String text, char acceleratorChar)
text
- the menu item's displayed text. An "_" in the string
indicates the location of the "mnemonic" key for that entry.acceleratorChar
- the shortcut char.public static javax.swing.KeyStroke[] shortcut(int[] keyCode)
keyCode
- key code without modifier.public static javax.swing.KeyStroke shortcut(int keyCode)
keyCode
- key code without modifier.public static void repeatLastCommand()
public java.lang.String getText()
public java.lang.String getToolTipText()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getDescription()
Menu | SubMenu | SubMenu | item
public int[] getPath()
protected void registerItem()
protected void registerUpdatable()
protected javax.swing.JMenuItem createMenuItem()
protected void updateMenuItem(javax.swing.JMenuItem item)
item
- item to update.public boolean isEnabled()
public boolean isSelected()
public char getMnemonicChar()
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
public abstract void run()
protected void updateButtons()