org.eclipse.swt.widgets
Class Menu
java.lang.Object
|
+--org.eclipse.swt.widgets.Widget
|
+--org.eclipse.swt.widgets.Menu
- All Implemented Interfaces:
- Drawable, Runnable
- public class Menu
- extends Widget
Instances of this class are user interface objects that contain
menu items.
- Styles:
- BAR, DROP_DOWN, POP_UP, NO_RADIO_GROUP
- LEFT_TO_RIGHT, RIGHT_TO_LEFT
- Events:
- Help, Hide, Show
Note:
Only one of BAR, DROP_DOWN and POP_UP may be specified.
Only one of LEFT_TO_RIGHT or RIGHT_TO_LEFT may be specified.
IMPORTANT: This class is not intended to be subclassed.
|
Field Summary |
protected int |
style
|
| 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 |
Menu(Decorations parent,
int style)
Constructs a new instance of this class given its parent
(which must be a Decorations) and a style value
describing its behavior and appearance.
|
Menu(Menu parentMenu)
Constructs a new instance of this class given its parent
(which must be a Menu) and sets the style
for the instance so that the instance will be a drop-down
menu on the given parent's parent. |
Menu(MenuItem parentItem)
Constructs a new instance of this class given its parent
(which must be a MenuItem) and sets the style
for the instance so that the instance will be a drop-down
menu on the given parent's parent menu. |
| Methods inherited from class org.eclipse.swt.widgets.Widget |
addListener, computeSize, dispose, focusState, getBorderWidth, getDisplayArea, getSelection, getStyle, getText, isDisposed, removeListener, setBounds, setCursor, stop |
| Methods inherited from interface java.lang.Runnable |
run |
style
protected int style
Menu
public Menu(Menu parentMenu)
- Constructs a new instance of this class given its parent
(which must be a
Menu) and sets the style
for the instance so that the instance will be a drop-down
menu on the given parent's parent.
- Throws:
IllegalArgumentException -
- ERROR_NULL_ARGUMENT - if the parent is null
SWTException -
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
- ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
- See Also:
SWT.DROP_DOWN,
Widget#checkSubclass,
Widget.getStyle()
Menu
public Menu(MenuItem parentItem)
- Constructs a new instance of this class given its parent
(which must be a
MenuItem) and sets the style
for the instance so that the instance will be a drop-down
menu on the given parent's parent menu.
- Throws:
IllegalArgumentException -
- ERROR_NULL_ARGUMENT - if the parent is null
SWTException -
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
- ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
- See Also:
SWT.DROP_DOWN,
Widget#checkSubclass,
Widget.getStyle()
Menu
public Menu(Decorations parent,
int style)
- Constructs a new instance of this class given its parent
(which must be a
Decorations) and a style value
describing its behavior and appearance.
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.
- Parameters:
parent - a decorations control which will be the parent of the new instance (cannot be null)style - the style of menu to construct
- Throws:
IllegalArgumentException -
- ERROR_NULL_ARGUMENT - if the parent is null
SWTException -
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
- ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
- See Also:
SWT.BAR,
SWT.DROP_DOWN,
SWT#POP_UP,
Widget#checkSubclass,
Widget.getStyle()
getParent
public Decorations getParent()
- Returns the receiver's parent, which must be a
Decorations.
- Returns:
- the receiver's parent
- Throws:
SWTException -
- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver