|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbuoy.event.EventSource
buoy.widget.Widget
buoy.widget.BMenuItem
public class BMenuItem
A BMenuItem is a Widget corresponding to an item in a pulldown menu. Each menu item typically represents a different command, which the user can issue by selecting it with the mouse.
It also is possible to select a menu item with the keyboard. There are, in fact, two different
ways of doing this. First, a menu item may have a Shortcut
associated with it.
This is a particular combination of keys, usually including a platform specific modifier key
such as Control or Meta. Whenever that combination of keys is pressed, the corresponding menu item
is immediately selected.
Second, many platforms allow keyboard navigation of menus and menu items. Typically, a user enters keyboard navigation mode by pressing a particular key. They can then use arrow keys to select a desired menu item, and Enter or Space to activate it. Keyboard navigation can be accelerated by assigning a mnemonic to each menu and menu item. When the user is in keyboard navigation mode, pressing the mnemonic key for a particular menu item will immediately select that item.
In addition to the event types generated by all Widgets, BMenuItems generate the following event types:
Constructor Summary | |
---|---|
BMenuItem()
Create a new BMenuItem with no label. |
|
BMenuItem(java.lang.String text)
Create a new BMenuItem. |
|
BMenuItem(java.lang.String text,
javax.swing.Icon image)
Create a new BMenuItem. |
|
BMenuItem(java.lang.String text,
Shortcut shortcut)
Create a new BMenuItem. |
|
BMenuItem(java.lang.String text,
Shortcut shortcut,
javax.swing.Icon image)
Create a new BMenuItem. |
Method Summary | |
---|---|
java.lang.String |
getActionCommand()
Get the "action command" which will be sent in a CommandEvent when this menu item is selected. |
javax.swing.JMenuItem |
getComponent()
Get the java.awt.Component corresponding to this Widget. |
javax.swing.Icon |
getIcon()
Get the image which appears next to this menu item. |
int |
getMnemonic()
Get the mnemonic which can be used to activate this menu item in keyboard navigation mode. |
Shortcut |
getShortcut()
Get the keyboard shortcut for this menu item. |
java.lang.String |
getText()
Get the text which appears on this menu item. |
void |
setActionCommand(java.lang.String command)
Set the "action command" which will be sent in a CommandEvent when this menu item is selected. |
void |
setIcon(javax.swing.Icon image)
Set the image which appears next to this menu item. |
void |
setMnemonic(int key)
Set the mnemonic which can be used to activate this menu item in keyboard navigation mode. |
void |
setShortcut(Shortcut shortcut)
Set the keyboard shortcut for this menu item. |
void |
setText(java.lang.String title)
Set the text which appears on this menu item. |
Methods inherited from class buoy.widget.Widget |
---|
addEventLink, dispatchEvent, getBackground, getBounds, getCursor, getFont, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, hasFocus, isEnabled, isFocusable, isVisible, repaint, requestFocus, setBackground, setCursor, setEnabled, setFocusable, setFont, setName, setVisible |
Methods inherited from class buoy.event.EventSource |
---|
addEventLink, addEventLink, removeEventLink |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BMenuItem()
public BMenuItem(java.lang.String text)
text
- the text to display on the BMenuItempublic BMenuItem(java.lang.String text, javax.swing.Icon image)
text
- the text to display on the BMenuItemimage
- the image to display next to the menu itempublic BMenuItem(java.lang.String text, Shortcut shortcut)
text
- the text to display on the BMenuItemshortcut
- a keyboard shortcut which will activate this menu itempublic BMenuItem(java.lang.String text, Shortcut shortcut, javax.swing.Icon image)
text
- the text to display on the BMenuItemshortcut
- a keyboard shortcut which will activate this menu itemimage
- the image to display next to the menu itemMethod Detail |
---|
public javax.swing.JMenuItem getComponent()
Widget
getComponent
in class Widget
public java.lang.String getText()
public void setText(java.lang.String title)
public java.lang.String getActionCommand()
public void setActionCommand(java.lang.String command)
public Shortcut getShortcut()
public void setShortcut(Shortcut shortcut)
public int getMnemonic()
public void setMnemonic(int key)
key
- the key code (defined by the KeyEvent class) which activates this menu itempublic javax.swing.Icon getIcon()
public void setIcon(javax.swing.Icon image)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |