|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--org.eclipse.swt.widgets.Widget
|
+--org.eclipse.swt.widgets.Item
|
+--org.eclipse.swt.widgets.MenuItem
Instances of this class represent a selectable user interface object that issues notification when pressed and released.
Note: Only one of the styles CHECK, CASCADE, PUSH, RADIO and SEPARATOR may be specified.
IMPORTANT: This class is not intended to be subclassed.
| Field Summary |
| Fields inherited from class org.eclipse.swt.widgets.Widget |
h, INCMD_DISPOSE, INCMD_EXTKEY, INCMD_KEY, INCMD_LDOWN, INCMD_LUP, INCMD_MENU, INCMD_POS, UPDATEITEM_ENABLED, UPDATEITEM_NAME, w, x, y |
| Constructor Summary | |
MenuItem(Menu parent,
int style)
Constructs a new instance of this class given its parent (which must be a Menu) and a style value
describing its behavior and appearance. |
|
| Method Summary | |
void |
setAccelerator(int accelerator)
Sets the widget accelerator. |
void |
setEnabled(boolean state)
Enables or disables a MenuItem. |
void |
setText(String string)
Sets the text of the MenuItem. |
| Methods inherited from class org.eclipse.swt.widgets.Item |
getImage, getText, setImage |
| Methods inherited from class org.eclipse.swt.widgets.Widget |
addListener, computeSize, dispose, focusState, getBorderWidth, getDisplayArea, getSelection, getStyle, isDisposed, removeListener, setBounds, setCursor, stop |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, toString |
| Methods inherited from interface java.lang.Runnable |
run |
| Methods inherited from interface org.eclipse.swt.graphics.Drawable |
drawLine, drawRect, drawText, setColor |
| Constructor Detail |
public MenuItem(Menu parent,
int style)
Menu) and a style value
describing its behavior and appearance. The item is added
to the end of the items maintained by its parent.
The style value is either one of the style constants defined in
class SWT which is applicable to instances of this
class, or must be built by bitwise OR'ing together
(that is, using the int "|" operator) two or more
of those SWT style constants. The class description
lists the style constants that are applicable to the class.
Style bits are also inherited from superclasses.
parent - a menu control which will be the parent of the new instance (cannot be null)style - the style of control to construct
IllegalArgumentException - SWTException - SWT.CHECK,
SWT.CASCADE,
SWT.PUSH,
SWT.RADIO,
SWT.SEPARATOR,
Widget#checkSubclass,
Widget.getStyle()| Method Detail |
public void setAccelerator(int accelerator)
SWT.MOD1 | SWT.MOD2 | 'T', SWT.MOD3 | SWT.F2.
SWT.CONTROL | SWT.SHIFT | 'T', SWT.ALT | SWT.F2.
accelerator - an integer that is the bit-wise OR of masks and a key
SWTException - public void setEnabled(boolean state)
state - true or falsepublic void setText(String string)
Mnemonics are indicated by an '&' that causes the next character to be the mnemonic. When the user presses a key sequence that matches the mnemonic, a selection event occurs. On most platforms, the mnemonic appears underlined but may be emphasised in a platform specific manner. The mnemonic indicator character '&' can be escaped by doubling it in the string, causing a single &' to be displayed.
Accelerator text is indicated by the '\t' character. On platforms that support accelerator text, the text that follows the '\t' character is displayed to the user, typically indicating the key stroke that will cause the item to become selected. On most platforms, the accelerator text appears right aligned in the menu. Setting the accelerator text does not install the accelerator key sequence. The accelerator key sequence is installed using #setAccelerator.
setText in class Itemstring - the new text
IllegalArgumentException - SWTException - setAccelerator(int)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||