|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjewl.Window
jewl.Control
jewl.TextControl
jewl.BooleanControl
jewl.MenuItem
An item that can be attached to a menu. Menu items generate a command code (a character) when they are selected. They are Boolean controls, and can be set to display a checkmark next to the item when the menu is displayed. Like other Boolean controls, the program can get or set the state of a menu item (checked or unchecked) and the text associated with it.
Since menus are not containers, the menu item's parent window will actually be the frame that the menu belongs to.
| Field Summary |
| Fields inherited from class jewl.TextControl |
CENTER, CENTRE, LEFT, RIGHT |
| Constructor Summary | |
MenuItem(Menu parent,
java.lang.String text,
char action)
Construct a new menu item attached to a specified menu which will generate a specified command code (a character) when selected. |
|
| Method Summary | |
void |
activate()
Activate this menu item as if it was selected by a mouse click. |
void |
setAlignment(int align)
Set the alignment of this menu item's text within its allocated area. |
void |
setLocation(int left,
int top)
Set the location of this menu item within the parent window. |
void |
setMenuKey(char key)
Set a menu accelerator key. |
void |
setSize(int width,
int height)
Set the size of this menu item. |
| Methods inherited from class jewl.BooleanControl |
getState, setState, toggle |
| Methods inherited from class jewl.TextControl |
getAlignment, getText, setKey, setText |
| Methods inherited from class jewl.Control |
disable, enable, enable, getToolTip, isEnabled, setToolTip |
| Methods inherited from class jewl.Window |
addEventListener, commandAvailable, getCommand, getFont, getHeight, getID, getLeft, getScreenHeight, getScreenWidth, getSource, getTop, getWidth, hide, init, isVisible, nextCommand, parent, root, setFont, setID, show, show |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public MenuItem(Menu parent,
java.lang.String text,
char action)
parent - the menu item's parent menu.text - the initial text displayed by the menu item.action - the command code generated when the menu item is selected.| Method Detail |
public void activate()
public void setSize(int width,
int height)
setSize in class Windowwidth - ignored.height - ignored.
public void setLocation(int left,
int top)
setLocation in class Windowleft - ignored.top - ignored.public void setAlignment(int align)
setAlignment in class TextControlalign - the desired alignment, specified using one of the values LEFT,
RIGHT, CENTRE or CENTER.public void setMenuKey(char key)
setKey, and a
menu item can have both a mnemonic key and an accelerator key
associated with it.
key - a letter or digit which will activate the menu item when pressed
together with the Control key. Anything other than a letter or digit
will be ignored.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||